cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
raoraheel
Helper I
Helper I

Parsing JSON for an array variable

I need help please!

I'm trying to build this flow where im appending an array variable with some data and later need to retrieve that to build an html table off it. I'm having hard time setting the variable correctly and then parsing it. Below are my excerpts of steps from my flow where im setting the variable and retrieving them where I get this error. 

 

1. Initializing variable

Screen Shot 2021-09-16 at 8.45.49 AM.png

 

2. Appending data to variable

Screen Shot 2021-09-16 at 8.46.09 AM.png

 

3. Parsing the data from variable

 

Screen Shot 2021-09-16 at 8.46.22 AM.png

 

 

{

    "type""array",

    "items": {

        "type""object",

        "properties": {

            "ItemId": {

                "type""string"

            },

            "BatchId": {

                "type""string"

            },

            "DateTime": {

                "type""string"

            },

            "Qty": {

                "type""string"

            },

            "Location": {

                "type""string"

            }

        }

    }

}

 

4. Error I receive when i run my flow.

In this screenshot also see how my data is being stored in the variable

 

Screen Shot 2021-09-16 at 8.50.54 AM.png

 

Any suggestions to help me fix this and do it correctly will be highly appreciated. Thanks

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ekarim2020
Resident Rockstar
Resident Rockstar

Can you send me a screenshot of the append to array action or the entire flow.

The data pasted above doesn't appear to be correct.  The Append to array action should resemble something like this, with no surrounding squares brackets [ ] :

ekarim2020_0-1631884469578.png

ekarim2020_1-1631885226152.png

Depending on what you are doing, you may not need to use Parse JSON. 

Ellis

View solution in original post

4 REPLIES 4
ekarim2020
Resident Rockstar
Resident Rockstar

Try modifying the Append to array action as:

ekarim2020_0-1631867905360.png

Example:

ekarim2020_2-1631868084320.png

 

Which results in an array

[
    {
        "Name""Apple",
        "Value""323"
    },
    {
        "Name""Mango",
        "Value""7731"
    }
]
 
Ellis

Ellis, when i do that and see the output in compose it looks like this

 

[
  "[\n{\n  \"Name\" : ItemId\"\n  \"Value\" : \"000875\"\n}\n{\n  \"Name\" : \"BatchId\"\n  \"Value\" : \"WO-025829SUB\"\n} \n {\n  \"Name\" : \"DateTime\"\n  \"Value\" :  \"2021-09-15T20:34:32Z\"\n}\n{\n  \"Name\" : \"Qty\"\n  \"Value\" : \"80\"\n{\n  \"Name\" : \"Location\"\n  \"Value\" : \"\"\n}]"
]
 
 
and when i use that to generate schema using sample I get this
 
{
    "type": "array",
    "items": {
        "type": "string"
    }
}
 
What am I still missing?
ekarim2020
Resident Rockstar
Resident Rockstar

Can you send me a screenshot of the append to array action or the entire flow.

The data pasted above doesn't appear to be correct.  The Append to array action should resemble something like this, with no surrounding squares brackets [ ] :

ekarim2020_0-1631884469578.png

ekarim2020_1-1631885226152.png

Depending on what you are doing, you may not need to use Parse JSON. 

Ellis

View solution in original post

This visual helped alot! It was that square bracket and quotations. I'm all set now and was able to parse correctly to create my HTML table. Thanks so much for your help, Ellis!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,467)