cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
titlerequired
Regular Visitor

PowerAutomate - JSON Schema

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?

3 REPLIES 3
sudharsan1985
Super User
Super User

Hi @titlerequired 

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.

Hope it helps, please like it or mark it as a solution if it resolves your clarification or issue
-Sudharsan K...

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,

power1.png

Hi @titlerequired 

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.

 

Hope it helps, please like it or mark it as a solution if it resolves your clarification or issue
-Sudharsan K...

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Users online (26,394)