Get data from HTTP response without ‘Parse JSON’ in Power Automate

“‘Parse JSON’ gives me a lot of useless dynamic contents, is there another way to parse the response from an HTTP request in Power Automate?”


When using HTTP requests in Power Automate, it’s recommended to use the ‘Parse JSON’ action to process the response. You take the HTTP response, use it as a sample payload in the ‘Parse JSON’, and the action will parse it for you. But if you do that, it’ll give you much more dynamic contents than you’d expect. It’ll parse everything in the HTTP response and add a ton of dynamic content, sometimes even doubling it. So, is there an easier way to get the data you need without using ‘Parse JSON’?

Power Automate http request parse json output

Access the data using expressions

When you look at the response from the HTTP request, you can see it’s a valid JSON. Let’s take an example, a response from an HTTP call that will return list of users in a SharePoint group.

_api/Web/SiteGroups/GetByID([ItemID])/users
Power Automate http request to get
Power Automate http request output

The body of the example response will look as above. There’s the main element “d” (1), subelement “results” (2) with an array of users, and the actual user data (3). You can recognize that “results” is an array by the square brackets [ ] enclosing the user information (3). Since you’re interested in the user data, you want to loop through all the “results” and get the desired value for each user.

Expression to access the array

The first step is to get only the “results’ array from the object, and then use it in an ‘Apply to each’ action to process all items (users). Start from the default ‘body’ output from the HTTP action, it’ll look like: outputs(‘HTTP request action name’)?[‘body’], e.g. as below.

outputs('Send_an_HTTP_request_to_SharePoint')?['body']

This dynamic content contains all the data as shown on the image above. But as was already mentioned, you need to go deeper, you want to go in the “d” and “results” elements.

outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']['results']

That’s the expression to use as the input of the ‘Apply to each’ action that will loop through all the results.

loop through http output array

Expression to access the value

Now it’s time to select the value you want to get from that array. When processing an array inside ‘Apply to each’, you can access the currently processed item with item() expression. To continue with the example from above, each item() will contain only the part 3.

user data in http response

You’ll define what value from the item() you want by adding its key to the item() expression in the format below:

item()?['Key']

e.g. to get user Email address
item()?['Email']

And that’s the expression you can use to access the desired value from an HTTP request response, in this example the user email.

power automate process http request output

Summary

I’d say that’s the key takeaway from this article is to think about any input of ‘Parse JSON’ as an object. If it needs parsing, it’s an object and you can do all the object operations with it.

‘Parse JSON’ will just parse it for you and make the use more convenient, but it’s not the only way. You can skip that action and do the parsing by yourself, take only the values you really need and leave the rest.

Also, the HTTP request in this article was taken just as an example. You can follow the same process with minor variations for any HTTP request and its outcome. It’s just another object after all.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Add a Comment

Your email address will not be published. Required fields are marked *