You are currently viewing PowerApps Parse JSON examples
parseJSON in PowerApps

PowerApps Parse JSON examples

  • Post author:
  • Post category:Power Apps
  • Reading time:9 mins read

In this blog post, we will discuss what is the PowerApps Parse JSON function, how to use, and how to extract information from the JSON to use in PowerApps.

We will learn:

  • PowerApps parse JSON from string
  • PowerApps Parse JSON to collection
  • PowerApps Parse JSON to table
  • PowerApps parse JSON array
  • and other parse JSON examples.

What is PowerApps Parse JSON function?

JSON stand for java script object  notation

The ParseJSON function in PowerApps can parse JSON strings into Power Fx objects and type and simplifies working with JSON in Canvas apps.


ParseJSON( JSONString )

The function takes JSONString – The JSON structure represented as text and it is required.

And return Untybed object which representing the JSON structure.

Untyped object is a data type in Power Fx that can hold any data structure, complex or simple

By using the PowerApps Parse JSON function, Power Fx allows makers to read JSON into an Untyped object that requires explicit conversion to a data type to use inside PowerApps.

To use any untyped object’s underlying values, they must be cast explicitly to their respective Power Fx types using type construction functions such as Boolean , Text, Value, DateTimeValue, and so on.

Till now only the ParseJSON() function returns untyped object.

PowerApps parse JSON from string

Before we use the flow to parse JSON strings ,Now by using the ParseJSON function , you can parse JSON string directly in PowerApps with out the need of flows.

The ParseJSON function in PowerApps allows us to parse data in JSON format, whether it is simple complex or array-based . We can use the output of the ParseJSON function to traverse through our JSON objects using dot notation, the index function, and other functions.

Suppose we have this JSON string that we need to extract the different information from it.

{ "Name": "Heba Kamal" ,"Age": 22, "Active":false,"ReleaseDate" : "2022-09-01"}	

Because PowerApps is strongly typed, we must ensure that we restore the data from that untyped object by leveraging text, value, Boolean, tables, date, etc.

PowerApps extract string from JSON string

The Name here in the JSON string is text, so to extract text from the JSON string we have to use the Text function to convert the output of the ParseJSON function “untyped object to text”.

PowerApps Parse JSON
Power Apps Parse JSON function

PowerApps extract number from JSON string

The Age here in the JSON string is number, so to extract number from the JSON string we have to use the Value function to convert the output of the ParseJSON function “untyped object to Number”.

PowerApps parse JSON from string

PowerApps extract Boolean from JSON string

json3 | Power Platform Geeks

PowerApps extract Date from JSON string

The ReleaseDate here in the JSON string is date, to extract date from the JSON string we have to use the DateValue function to convert the output of the ParseJSON function “untyped object to date”.

json 4 | Power Platform Geeks

Parse table in JSON string

You can use the ParseJSON function to extract tables from the JSON string

[{ "Name": "Heba Kamal" ,"Age": 22, "Active":false,"ReleaseDate" : "2022-09-01"},{ "Name": "samerKamal" ,"Age": 27, "Active":true,"ReleaseDate" : "2022-09-21"}]		

To extract table you can use the Table function to convert the Untyped object of the ParseJSON to table so that you can use as a data source in your app, or you can bind it to a gallery or to collection.

Table( ParseJSON(Label3_1.Text))
json5 | Power Platform Geeks

You can use the for all function to loop in your JSON string and collect the rows in your collection as shown in the bellow code.

            Name: Text(Value.Name),
            Age: Value(Value.Age),
            ReleaseDate: DateValue(Value.ReleaseDate)
json6 | Power Platform Geeks
See Also
Join us
Need Help
  • Have a related question? Please ask it at Community.

Heba Kamal

Microsoft MVP, MCT, Technical Speaker, Blogger, and Microsoft 365 and Power Platform Consultant.