The payload
An interesting feature of associations is that it allows for the use of nested data. By loading data for the questionnaire and its steps and questions as a single JSON object, the child's steps and questions association will be populated too. For example, take a look at this JSON:
{ "id": 1, "title": "Quiz Questions!" "introduction": "Welcome!", "conclusion": "Thanks!", "steps": [ { "id": 1, "title": "Round 1" "introduction": "Welcome to Round One!", "questionnaireId": 1, "questions": [{ "id": 1, "questionText": "Turku is the third largest city by population of which European country?", "required": true, "stepId": 1, "type": "textfield" }], } ] }
This object includes data for the questionnaire with an array of child steps. The steps have their own array of questions, as shown here:
Questionnaire...