I'm using PowerAutomate to query an API. It successfully returns a JSON which is an array of objects. Im struggling to run an 'apply to each' against the results and i think it is due to the JSON schema i am using to parse the json response body. The apply to each doesnt seem to be able to distinguish the different objects inside the array. Does anyone have any experience of that, and could offer some suggestions?
Try to use the action Parse JSON with some sample JSON data, which will create a schema based on the sample data. Also, to better understand the issue, please post some screenshots.
Thanks for the reply.
I have been trying to create a schema based on the response data (which i have done in previous steps) but i dont really understand the structure of how the schema should be.
The response body might contain several devices, or many devices, each with 00s of properties but i really only want 5 or 6 of them.
1 of the properties may or may not exist.
If someone could help me to make a schema to only capture or pass certain properties through that would be really helpful.
This was a schema i tried a few attempts back,
{
"type": "object",
"items": {
"type": "array",
"properties": {
"_id": {
"type": "string"
},
"ip": {
"type": "string"
},
"mac": {
"type": "string"
},
"model": {
"type": "string"
},
"type": {
"type": "string"
},
"version": {
"type": "string"
}
},
"required": [
"_id",
"ip",
"mac",
"model",
"type",
"version"
]
}
}
And the response,
Your requirement is obscure to me. But the error is due to the direct access of the object, and you shouldn't send the object instead try to add it to an array and send the array, it should work.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
74 | |
27 | |
18 | |
16 | |
14 |
User | Count |
---|---|
138 | |
44 | |
32 | |
32 | |
29 |