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
Super User
Super User

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
Super User
Super User

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
Super User
Super User

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

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (3,483)