How to use the ParseJSON function in Power Apps to convert data

When building a Power App, it is sometimes the case that you must work with data of a format that cannot be directly handled or recognized by the platform. This is particularly the case when connecting your app to Power Automate flows or other external connectors, which often return data in a JSON format. In these scenarios, the “ParseJSON” function will help you interpret and digest this raw data, and use it to create Tables, Collections and Variables.

It is important to note that the ParseJSON function, first and foremost, is a way to interpret and respect the structure of an inbound JSON object, and its direct output is what is referred to as an ‘Untyped Object’. In plain terms, this denotes a generic data structure that is unaware of the specific types of data it contains, and therefore cannot be directly used without further interpretation.

The parseJSON functionality was introduced in 2022 to parse JSON strings into Power Fx objects and types. It is the first, and for now the only function to return an untyped object.

Microsoft defines Untyped Objects as follows:

An Untyped object is a data type in Power Fx that can hold any data structure, complex or simple. It can’t be used directly in any Power App that we create and requires explicit conversion to the required data type before processing. Fields in records in an untyped object can be accessed using the dot notation, and existence of fields is only verified at runtime.

Example where we face untyped objects in Power Apps:

A very common scenario is where we want to fetch items from our data source using Power Automate and return the value to Power Apps for further processing.

The response is sent back to Power Apps using the action ‘Respond to Power Apps.’

Advantages of using this action:

  • Not a premium connector

Disadvantages of using this action:

  • Response only supports the following data types: Text, Number, Yes/No, File & Date

Hence, we can’t send responses with complex data structures e.g., Table/ Collection of various datatypes.

Use the ParseJSON function in Power Apps to process complex data structures

The ‘ParseJSON’ function in PowerApps can parse JSON strings into Power Fx objects and different data types and simplifies working with JSON in Canvas apps.

There are two major steps to achieving this:

  1. Send a response to Power Apps in a JSON string format from flow.
  2. Activate and use the ParseJSON function in Power Apps and JSON string to convert to a collection of data.

STEP 1: Send a response to Power Apps in a JSON string format from flow

  1. Open Power Automate and select ‘PowerApps’ as a trigger for the flow:
select ‘PowerApps’ as a trigger for the flow:

2. Select ‘Get Items’ as your next action – From your SharePoint list. We can also have our filters in place to optimise.

Note: In case you have more than 5000+ items in SharePoint list, we shall be using $batch apis -> Send HTTP request to SharePoint as an action.

Find more information on $batch calls here.

How to use parseJSON in Power Apps to convert data

3. Click on the + and choose ‘Select’ as your next action. – This is a major step as it is important how we send our response back to Power Apps. Here we are sending it as a string. This step will format our string in JSON which we can manipulate later in Power Apps to generate a table.

How to use parseJSON in Power Apps to convert data

4. Select the ‘Compose – Items’ action – This is an additional step to manage the datatype of the pervious step’s output.

How to use parseJSON in Power Apps to convert data

5. Respond to Power App or flow – Use the outputs from ‘Compose – Items’ as a response to send back to Power Apps.

How to use parseJSON in Power Apps to convert data

STEP 2: Activate and use ‘ParseJSON’ function in Power Apps and convert JSON string to a collection of data.

  1. Activate the “Preview feature” -> “ParseJSON” from the Power App settings in your application.
How to use parseJSON in Power Apps to convert data

2. …

Download the FREE guide below for the next steps. This guide has been carefully prepared by our Microsoft 365 consultant with detailed steps and supporting images.

How to use the ParseJSON function in Power Apps to convert data

Receive more blogs like this straight into your inbox

Sign up to receive our latest blogs and stay up to date with our latest news, Microsoft 365 updates, events, webinars and workshops.

Share This Article

Rituparna Khatua
I've been working and growing in the software industry for 6 years and I'm driven towards Microsoft technologies. I like to get involved in projects where I can learn and add new abilities to my skill set.
Published On: September 11th, 2023 Categories: Power Platform

Subscribe for updates

Follow Us: