CodexBloom - Programming Q&A Platform

Azure Logic Apps: How to Properly Handle JSON Responses with Nested Arrays?

👀 Views: 0 đŸ’Ŧ Answers: 1 📅 Created: 2025-08-30
azure logic-apps json api

I've been working on this all day and I'm a bit lost with I'm working with Azure Logic Apps to process an API response that includes nested JSON arrays. The API I'm consuming returns a structure like this: ```json { "data": [ { "id": "1", "items": [ { "name": "item1", "value": 100 }, { "name": "item2", "value": 200 } ] }, { "id": "2", "items": [ { "name": "item3", "value": 300 }, { "name": "item4", "value": 400 } ] } ] } ``` I need to extract the `items` array from each object in the `data` array, but I'm struggling with how to set up the Logic App to handle this nested structure correctly. Currently, I'm using the 'Parse JSON' action to parse the response, but when I try to loop through the `data` array using the 'For Each' action, I get an behavior stating: "The input is not a valid JSON object". I've tried changing the schema multiple times, but it doesn't seem to recognize the nested structure. Here's the schema I'm trying to use for the 'Parse JSON' action: ```json { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "items": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "value": { "type": "integer" } }, "required": ["name", "value"] } } }, "required": ["id", "items"] } } } } ``` After parsing, I'm using the following expression to access the `items` within the 'For Each': `items('Parse_JSON')?['data']`. However, this leads to the behavior mentioned above. I've double-checked the JSON structure and it seems valid, but I'm unsure how to format my Logic App correctly to loop through the nested arrays. Any insights or suggestions would be greatly appreciated! This is part of a larger desktop app I'm building. What's the best practice here? For reference, this is a production web app. Could someone point me to the right documentation? This is part of a larger web app I'm building. Any advice would be much appreciated.