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

Report
All responses (
Answers (