Power Apps Parse JSON function

Everything you need to know about using the Power Apps Parse JSON function

The ParseJSON function in Power Apps will convert a JSON string into an untyped Object. We can leverage the Power Apps Text, Value, Boolean an Index functions using dot notation to access the data in a JSON string. This opens up opportunities to store repeating data in a single SharePoint record, for example storing responses to a Survey in a single record rather than multiple records.

 

Example JSON

In the example below a JSON string has been addd to a Power Apps label called txtJSONString.

 

txtJSONString

{​​​​​​​
    "QuestionID": 1,
    "Question": "What is your name?",
    "Response": "Dean",
    "Completed: true
}​​​​​​​

We can access the data within this string using the ParseJSON function. The result of the ParseJSON function is untyped which means we must apply a data type. Examples of casting common types are outlined below:

Number Type

Value(ParseJSON(txtJSONString.Text).QuestionID)

Output: 1

 

Text Type

Text(ParseJSON(txtJSONString.Text).Question)

Output: What is your name?

 

Boolean
Boolean(ParseJSON(txtJSONString.Text).Completed)

Output: true

 

Parse an array of string values

 
txtJSONCars
["Ford", "BMW", "Honda", "Toyota"]
 
To parse an array of string values in Power Apps we typecast to a Table then use Index to get the value.
 
Text(Index(Table(ParseJSON(txtJSONCars.Text),2).value)
 
This will get the value: "BMW"
 

Parse an array of Objects

 
txtJSONResponses
 
[
  {
      "QuestionID": 1,
      "Question": "What is your name?",
      "Response": "Dean"
  },
  {
      "QuestionID": 2,
      "Question": "What is your age?",
      "Response": "44"
  }
]
 
Get the question text of the 2nd object in the array
Text(Index(Table(ParseJSON(txtJSONResponses.Text),2).value.Question)
 
This will get the value: "What is your age?"
 
 
Display JSON data in a Power Apps gallery
 
​​​​​​​Table1.Items
Table(ParseJSON(txtJSONCars.Text)
 
To access individual records
Text(ThisItem.Value.Question)