Need help parsing this JSON - What I want to do is write a Compose that will output every 'answer' under subquestions (can be found under root->data->survey_data->"19"->subquestions->(number)->answer. I've been able to parse it and convert the data to an array as variable DataArray with array(body('Parse_JSON')?['data']) but that just gives me everything under 'data'. I want everything under 'subquestions'. But when I substitute 'subquestions' for 'data' it just returns null. Schema is below. I'm a total noob at this so please let me know if I can further clarify.
{
"type": "object",
"properties": {
"result_ok": {
"type": "boolean"
},
"total_count": {
"type": "integer"
},
"page": {
"type": "integer"
},
"total_pages": {
"type": "integer"
},
"results_per_page": {
"type": "integer"
},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"contact_id": {
"type": "string"
},
"status": {
"type": "string"
},
"is_test_data": {
"type": "string"
},
"date_submitted": {
"type": "string"
},
"session_id": {
"type": "string"
},
"language": {
"type": "string"
},
"date_started": {
"type": "string"
},
"link_id": {
"type": "string"
},
"url_variables": {
"type": "array"
},
"ip_address": {
"type": "string"
},
"referer": {
"type": "string"
},
"user_agent": {
"type": "string"
},
"response_time": {
"type": "integer"
},
"longitude": {
"type": "string"
},
"latitude": {
"type": "string"
},
"country": {
"type": "string"
},
"city": {
"type": "string"
},
"region": {
"type": "string"
},
"postal": {
"type": "string"
},
"dma": {
"type": "string"
},
"survey_data": {
"type": "object",
"properties": {
"ParentQuestionID": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"type": {
"type": "string"
},
"question": {
"type": "string"
},
"subquestions": {
"type": "object",
"properties": {
"SubQuestions": {
"type": "object",
"properties": {
"subquestionid": {
"type": "integer"
},
"question": {
"type": "string"
},
"type": {
"type": "string"
},
"parent": {
"type": "integer"
},
"answer": {
"type": "string"
}
}
}
}
},
"section_id": {
"type": "integer"
},
"shown": {
"type": "boolean"
}
}
}
}
}
},
"required": [
"id",
"contact_id",
"status",
"is_test_data",
"date_submitted",
"session_id",
"language",
"date_started",
"link_id",
"url_variables",
"ip_address",
"referer",
"user_agent",
"response_time",
"longitude",
"latitude",
"country",
"city",
"region",
"postal",
"dma",
"survey_data"
]
}
}
}
}
hi @Anonymous do you try using parse json? did you use that action before?
Proud to be a Flownaut!
@ChristianAbata I did use parseJSON before (see attached screenshot). And then I put it into a variable DataArray(array type) using this
You have to string them together I believe, so array(body('Parse_JSON')?['data']?['Survey_data']?['Parentquestionid']?['Subquestions'] ... and so on
User | Count |
---|---|
101 | |
36 | |
29 | |
25 | |
16 |
User | Count |
---|---|
133 | |
54 | |
53 | |
36 | |
26 |