web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / using json fields as v...
Power Automate
Answered

using json fields as variables

(0) ShareShare
ReportReport
Posted on by 39

Hi All,

I have a json output, that I get through an API. It contains quite a lot of information, but I am only interested in 2 values, farmID and PartID.

 

I have been trying to use Parse JSON to read the data, and to input the fields into a variable of type array, but for some reason, even though visualy the output of the parse json is fine, whenever i try to use the data, the value comes back as NULL. 

 

(I have also tried using single variables and somehow loop through those using the json data, but that also didnt work


I am thinking my schema for the parse json maybe the culprit, but I dont know how to check.  The schema is created by uploading a sample json in the field in power automate. ( i have tried both the full output, as a cleaned up version with just some fields)

 

Anybody any ideas, or maybe have a better idea on how i can use those two specific fields to create a loop? What i need to achieve is use a combination of farmid and partyID to get specific data, and do that for about roughly 30 combinations of farmID and partyID


Do i maybe need to use an expression to get a specific field from the json array?

 

EDIT: 
I have completely stripped the json to:

 

hanssmeets_0-1707692786584.png

But when i go to fill the variable, i can only choose "body farms" but dont I somehow have to tell it to fill it with Body farms [0]?

hanssmeets_1-1707692878283.png

 

Below some extra information

----------------------------------------------------------------

The error:

hanssmeets_1-1707691473056.png

-------------------

Pasre json result: (there are multiple farms, this is just 1)

{
"code": "200",
"message": "Success",
"correlationId": "0f3d5e30-c92f-11ee-842c-023179edcba9",
"databody": {
"farms": [
{
"name": "32534",
"farmId": "32534",
"relationships": [
{
"partyId": "20251",
"accessType": "FirstParty",
"startDate": "2016-07-15",
"endDate": null,
"mpqAccessStartDate": "2012-06-01",
"hashIds": [
"12ed73d5c88ea5517eda88275a814f754836d59bbb4d750f21127b0162c57ef7"
]
}
]
},

------------------------------

JSON Sample (from postman)

hanssmeets_0-1707691382478.png

 

------------------

Schema

{
    "type": "object",
    "properties": {
        "code": {
            "type": "string"
        },
        "message": {
            "type": "string"
        },
        "correlationId": {
            "type": "string"
        },
        "databody": {
            "type": "object",
            "properties": {
                "farms": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "name": {
                                "type": "string"
                            },
                            "farmId": {
                                "type": "string"
                            },
                            "relationships": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "partyId": {
                                            "type": "string"
                                        },
                                        "accessType": {
                                            "type": "string"
                                        },
                                        "startDate": {
                                            "type": "string"
                                        },
                                        "endDate": {},
                                        "mpqAccessStartDate": {
                                            "type": "string"
                                        },
                                        "hashIds": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        }
                                    },
                                    "required": [
                                        "partyId",
                                        "accessType",
                                        "startDate",
                                        "endDate",
                                        "mpqAccessStartDate",
                                        "hashIds"
                                    ]
                                }
                            }
                        },
                        "required": [
                            "name",
                            "farmId",
                            "relationships"
                        ]
                    }
                }
            }
        },
        "offset": {
            "type": "integer"
        },
        "count": {
            "type": "integer"
        },
        "_links": {
            "type": "object",
            "properties": {
                "self": {
                    "type": "string"
                },
                "first": {
                    "type": "string"
                },
                "previous": {},
                "next": {},
                "last": {
                    "type": "string"
                }
            }
        }
    }
}
----------------
 
 
Categories:
I have the same question (0)
  • Verified answer
    Hans Smeets Profile Picture
    39 on at

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard