cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
wowen
New Member

Problem with Parse JSON - is of type 'Null'. The result must be a valid array.

Hi, I'm extracting data from a sharepoint list via a HTTP Rest API call and then parsing the output which ends up with a relatively simple looking JSON extract. But when I try and loop through it, I get the following error....

 

The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@body('Parse_JSON')?['body']?['value']' is of type 'Null'. The result must be a valid array.

 

The output from my PARSE JSON is in this format (trunctuated and anonymised for simplicity). I've tried googling, and am sure there is a simple thing I'm doing wrong, but not sure what

 

 

{
    "body": {
        "odata.nextLink": "https://myurlwiththeAPIcall.com",
        "value": [
            {
                "myID": 1234,
                "Match_x0020_Level": "Exact",
                "GroupID": "bae26ea6"
            },
            {
                "myID": 2345,
                "Match_x0020_Level": "Exact",
                "GroupID": "aaf12f0e"
            }
        ]
    }
}

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
vivekpande18
Impactful Individual
Impactful Individual

Hi @wowen ,

 

You are almost right. Just do a small tweak in your expression like below. Remove the body from the expression.

 

@body('Parse_JSON')?['value']'

 

It should work now.

 

Thanks,

Vivek Pande

 

If this post helps answer your question, please click on "Accept as Solution" to help other members find it more quickly.

If you thought this post was helpful, please give it a Thumbs Up

View solution in original post

2 REPLIES 2
vivekpande18
Impactful Individual
Impactful Individual

Hi @wowen ,

 

You are almost right. Just do a small tweak in your expression like below. Remove the body from the expression.

 

@body('Parse_JSON')?['value']'

 

It should work now.

 

Thanks,

Vivek Pande

 

If this post helps answer your question, please click on "Accept as Solution" to help other members find it more quickly.

If you thought this post was helpful, please give it a Thumbs Up

ekarim2020
Super User
Super User

Hi @wowen ,

 

Use the sample data to generate the JSON schema:

Snag_373c7bd.png

 

Snag_377f504.png


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

 

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,464)