Skip to main content

Notifications

Power Apps - Power Apps Pro Dev & ISV
Unanswered

How to Dynamically Process Nested JSON in Power Apps Without Predefined Schema?

(2) ShareShare
ReportReport
Posted on by 1

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"
    }
  ]
}

I need to dynamically process this data in Power Apps without hardcoding field names, while still accommodating changes in the API's response format.
 
The Method I try is:
  1. Tried Flattening in Power Apps:

    • I used functions like 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.
  2. Tried Key-Value Pair Mapping:

    • I attempted to extract key-value pairs from the JSON using nested 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.

 

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard