Categories: Microsoft Flow

Query json in Power Automate

One of the important fundamental parts of Power Automate flow development is understanding how to query json.

Example json

Some data is made available in part of the flow by an action and now you need to get to an element of this data. The data is all presented in json.

As a simple example of json we can have data like this.
{
  "level1": { "level2": "data"}
}

For a more details description of the json language please have a look at json site.

Query json

Many people would now use the following syntax to query the json to get to the level2 data:

outputs('Compose')?['level1']?['level2']

This would give you:

Optimized query json

A similar query approach, with a slightly different syntax can be:

outputs('Compose')?['level1/level2']

At first I didn’t really see too much of an advantage of using this syntax, but when you reopen the flow you will see the advantage straight away:

Now compare that with the other syntax:

The query on the Compose json actually shows the elements that your flow will try query.

Other approaches

To make sure that your json elements are accessible within your flows as Dynamic content you could also consider using the parse json action. This action I’ve described in the post below.

Use 1 Parse JSON action to validate data

Share
Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

View Comments

Recent Posts

Create new group alert using Power Automate

Do you want to know when a new group has been created with for example…

3 days ago

Delegation Warnings in Power Apps

We have all seen them, Delegation Warnings, but what is delegation and how do you…

3 days ago

1 Top tip: PowerPlatformLearn.com and master the Power Platform within no time

It can be difficult to get started with the Power Platform, blogs help, training helps,…

2 weeks ago

Compare 2 Excel files using Power Automate

This is such a common scenario. You receive Excel files on a regular basis and…

2 weeks ago

Rename SharePoint folders using Power Automate in 2 easy steps

Have you ever wanted to rename SharePoint folders with Power Automate? REST API call to…

3 weeks ago

Read dates from Excel with Power Automate

To read dates from Excel files can be tricky, as Excel only give you the…

4 weeks ago
%%footer%%