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(ParseJSON(txtJSONString.Text).Completed)
Output: true
Parse an array of string values
["Ford", "BMW", "Honda", "Toyota"]
Text(Index(Table(ParseJSON(txtJSONCars.Text),2).value)
Parse an array of Objects
[
{
"QuestionID": 1,
"Question": "What is your name?",
"Response": "Dean"
},
{
"QuestionID": 2,
"Question": "What is your age?",
"Response": "44"
}
]
Text(Index(Table(ParseJSON(txtJSONResponses.Text),2).value.Question)
Table(ParseJSON(txtJSONCars.Text)
Text(ThisItem.Value.Question)