I am working on a Power Apps application where I need to handle data returned from an API dynamically. The API response contains nested JSON objects, arrays, and sometimes objects within arrays. The challenge is that the structure of the JSON can change over time, making it impractical to hardcode field names or manually map properties.
Here are two examples of the API response structures I receive:
Example 1:
{
"content": [
{
"name": "Marywood University",
"alpha_two_code": "US",
"domains": ["marywood.edu"],
"country": "United States",
"web_pages": ["https://www.google.com"],
"state-province": null
},
{
"name": "Lindenwood University",
"alpha_two_code": "US",
"domains": ["lindenwood.edu"],
"country": "United States",
"web_pages": ["https://www.google.com"],
"state-province": null
}
]
}
Example 2:
{ "results": [ { "gender": "female", "name": { "title": "Ms", "first": "Jessica", "last": "Perry" }, "location": { "street": { "number": 8932, "name": "Manor Road" }, "city": "Kilcoole", "state": "Meath", "country": "Ireland" }, "email": "jessica.perry@example.com" } ] }
Tried Flattening in Power Apps:
ParseJSON
, Table
, and ForAll
to dynamically extract the properties of the JSON. However, Power Apps lacks native support for iterating over object properties or handling arrays within nested JSON dynamically.Tried Key-Value Pair Mapping:
ForAll
loops, but encountered errors like Name isn't valid
or Text function has invalid arguments
when processing dynamic fields like PropertyName
and PropertyValue
.Expected Outcome:
I want to create a solution where Power Apps can dynamically process JSON data (including nested objects and arrays), regardless of the structure, and display it in a gallery or collection without requiring manual adjustments each time the API changes.