ParseJSON is brand spanking new. Started looking at it last week and it seems to be working nicely. Had a few issues on how to get data out myself in a Gallery, into a label. Finally sorted it so I thought I'd share.
Here is an example of how I’m using it so far …
‘ThisItem.Answer’ …. In a gallery contains the following …
[
"Text 1",
"Text 2",
"Text 3"
]
… using the following code ….
Concat(Table( ParseJSON( ThisItem.Answer )), Text(Value) & "
")
… gives me …
Text 1
Text 2
Text 3
Also … If you’re dealing with JSON holding records and fields like below. In this example, the gallery records now holds the data below in ‘ThisItem.Answer’ ...
[
{
"name": "TheFileName.xlsx",
}
]
… you can use the following to get a field into a label ..
With( First(Table( ParseJSON( ThisItem.Answer ))),
Value.name
)
.. which will give you … ‘TheFileName.xlsx’.
As you are working with tables and records, maybe a ForAll could be used as well. Not yet tried this, if you do, past your results in this thread.
🙂
Yes...it is a long overdue function!!
It would be nice to provide a schema to it (in the case of records and tables), but it is easy to convert from the untyped result to either one.
Since ForAll is a table producing function, it is perfectly fit for returning a table of the parsed JSON.
The docs for the ParseJSON function have a so-so example of converting a JSON table to a typed table in PowerApps.
Thanks for sharing!
Oh...and if you haven't looked at Named Functions yet - well worth a look!!
User | Count |
---|---|
252 | |
107 | |
88 | |
51 | |
44 |