Hello PowerApps Community!
Is there a way of parsing a JSON object in a column from an SQL Server database to a collection in PowerApps?
I generated the JSON object using the JSON function with data from a collection, but now I want to retrieve the object from the database and revert the process.
Right now the JSON in the SQL column looks like this:
[{"Active":true,"Name":"Option_1"},{"Active":true,"Name":"Option_2"},{"Active":true,"Name":"Option_3"},{"Active":true,"Name":"Option_4"}]
And I need it in a collection with the same fields (Active and Name). The alternative would be to have 4 additional columns in the table, but I really want to avoid that, as it will probably need to scale in the future without adding columns to the table.
EDIT UPDATE:
As of right now, I managed to edit the text value (hard-coding but it's fine). However, when ClearCollect it detects it as text and doesn't create the collection as it should.
This works (copying and pasting the result from the edited SQL Server column):
ClearCollect(ColTest; {Active:true;Name:"Option_1"};{Active:true;Name:"Option_2"};{Active:true;Name:"Option_3"};{Active:true;Name:"Option_4"})
This doesn't work:
ClearCollect(ColTest; JSONText)
// JSONText = "{Active:true;Name:"Option_1"};{Active:true;Name:"Option_2"};{Active:true;Name:"Option_3"};{Active:true;Name:"Option_4"}"
I know it is because it is taking it as a string, is there a way to avoid that?
Thanks