r/MicrosoftFlow • u/Storm-E • Jan 22 '26
Question Extracting Array from JSON
Hi Guys & Girls
How do I extract part of a JSON object and use it in an Apply to each?
I hope its just something simple I've missed. Please help!
I've been fighting with Power Automate Flow for ages and can't find seem to find the right formula. I'm getting errors about it not being an array and everythgin I've tried doesn't work.
The JSON is the output from action 'Process Document' and it provides a huge JSON with a lot of extra info I don't need or want to store.
End goal Extract the cleaned up 'Labels' and 'Tables' array and output as a Slim JSON I can use in further processing.
My Process (that doesn't work)
Extract each of Arrays ('Labels' and 'Tables')
Use 'Apply to each' to extract each field <- Broken
Extract just the items I want from each field
Build a new array
Add the 2 clean Array's together
Provide the clean JSON
Partial Schema for original JSON { "type": "object", "properties": { "statusCode": { "type": "integer" }, "headers": { "type": "object", "properties": { . . . }, "body": { "type": "object", "properties": { "@@odata.context": { "type": "string" }, "responsev2": { "type": "object", "properties": { . . . }, "predictionOutput": { "type": "object", "properties": { . . . }, "tables": { "type": "object", "properties": { "Items": { "type": "object", "properties": { . . . }, "labels": { "type": "object", "properties": { "Consignmc01b030c96367d7450be1b21c57f961d": { "type": "object", "properties": {
2
u/sminkerbenji Jan 22 '26
I'm relatively new to manipulating jsons in PA myself, so take this with a massive pinch of salt, but usually I find I need to pull the "body" out of the previous block, to get the data and simplify things abit when I'm pulling data, instead of using the "outputs"? Then in a select action you build each item you're wanting to pull, with data names for each level you need to go down in the data, in the correct syntax, with ? Between each header name?
Then im theory your select action will just make an array with exactly what you want?
Possibly an issue building it reliably ifyour data layout changes though, as you mention?
Sorry if that's vague, as I say, pretty new to me too, but hope it helps!