Skip to main content

Notifications

Community site session details

Community site session details

Session Id : GDHAVPfte1Td5WxVLUwYIz
Power Apps - Building Power Apps
Unanswered

Using ParseJSON inside Power Apps Canvas App to parse a JSON String rather than JSON object

Like (0) ShareShare
ReportReport
Posted on 11 Jan 2023 17:38:57 by 139

Hello Team,
I am trying to parse JSON string using ParseJSON() method in the Canvas App. However, it looks like it's expecting a JSON object as an input rather than a JSON string. I have no issues if I parse that JSON string to a JSON object using JavaScript and then pass it to this ParseJSON().

 

// JSON String
"{\"changedAttributes\":[{\"logicalName\":\"cre1a_app_modified_on\",\"oldValue\":\"06/23/2022 17:06:41\",\"newValue\":\"01/09/2023 20:55:22\"},{\"logicalName\":\"cre1a_order_summary_ml\",\"oldValue\":null,\"newValue\":\"testing order summary update audit\"},{\"logicalName\":\"cre1a_order_notes_ml\",\"oldValue\":null,\"newValue\":\"<p>testing order notes audit</p>\"}]}"

//JSON Object
{
 "changedAttributes": [
 {
 "logicalName": "cre1a_app_modified_on",
 "oldValue": "06/23/2022 17:06:41",
 "newValue": "01/09/2023 20:55:22"
 },
 {
 "logicalName": "cre1a_order_summary_ml",
 "oldValue": null,
 "newValue": "testing order summary update audit"
 },
 {
 "logicalName": "cre1a_order_notes_ml",
 "oldValue": null,
 "newValue": "<p>testing order notes audit</p>"
 }
 ]
}
/* Logic implemented inside the PowerApps. This works when we pass JSON object to Label1 but not JSON String */
ClearCollect(
 colGalleryItems,
 ForAll(
 Table(ParseJSON(Label1.Text).changedAttributes),
 {
 logicalName: Text(Value.logicalName),
 oldValue: Text(Value.oldValue),
 newValue: Text(Value.newValue)
 }
 )
)

 

I am getting this JSON string from a custom connector which needs to be parsed inside Canvas App to display in a gallery. Let me know if this is feasible ins PowerApps, otherwise, what are my ways to transform this response inside the custom connector itself? The above JSON String is changedata value inside the JSON something like below.

 

{
 "_objectid_value@OData.Community.Display.V1.FormattedValue": "111",
 "createdon": "2023-01-09T20:55:22Z",
 "versionnumber": 0,
 "changedata": "{\"changedAttributes\":[{\"logicalName\":\"cre1a_app_modified_on\",\"oldValue\":\"06/23/2022 17:06:41\",\"newValue\":\"01/09/2023 20:55:22\"},{\"logicalName\":\"cre1a_order_summary_ml\",\"oldValue\":null,\"newValue\":\"testing order summary update audit\"},{\"logicalName\":\"cre1a_order_notes_ml\",\"oldValue\":null,\"newValue\":\"<p>testing order notes audit</p>\"}]}"
}

 

I referred to this article too https://powerusers.microsoft.com/t5/Power-Apps-Experimental-Features/ParseJSON-feedback/m-p/1877977#M200

Thanks,
Srinivas

  • SJC Profile Picture
    32 on 20 Jun 2023 at 13:09:47
    Re: Using ParseJSON inside Power Apps Canvas App to parse a JSON String rather than JSON object

    You need to iterate through the result of ParseJSON to extract the data explicitly.

    See ParseJSON function in Power Apps - Power Platform | Microsoft Learn

     

    ForAll( ParseJSON( JsonString ).array, { id: Value(ThisRecord.id), name: Text(ThisRecord.name) })

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,745 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard
Loading started