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

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

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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (2,762)