cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
spyderbuilt
Level: Powered On

Limit nested JSON objects in Flow before sending to Powerapps

I am trying to send a JSON object from Flow to Powerapps to create a collection to use in Powerapps. The problem is that my JSON object has too many nested objects that exceeds the limits of the nested Gallery controls connected to my Powerapps collection (which is 2).

 

How do I trim my JSON object so the nested items are only 2 levels deep. In the example of my response how to I get rid of the "responses" level using flow. I think I need to use for each as I have seem something similar to flattening a JSON object for a csv table but cant seem to get it right.

 

Response:

{
  "responses": [
    {
      "webDetection": {
        "webEntities": [
          {
            "entityId": "/m/01ncmt",
            "score": 0.7314,
            "description": "Thermostat"
          }
        ],
        "fullMatchingImages": [
          {
            "url": "https://shop.gottwald.at/media/image/product/4712/md/siemens-rde1001-raumthermostat-mit-auto-zeitschaltprogramm-und-lcd-batterie.jpg"
          }
        ],
        "partialMatchingImages": [
          {
            "url": "https://gepesz.hu/shop/kicsi/kicsi.php?forras=SIE/SIE_RDE100-1.png&meret=0"
          }
        ],
        "pagesWithMatchingImages": [
          {
            "url": "https://www.siemens.com/uk/en/home/products/buildingtechnologies/residential-controls/temperature-control.html",
            "pageTitle": "Temperature control - Residential controls - United ... - <b>Siemens</b>",
            "fullMatchingImages": [
              {
                "url": "https://www.siemens.com/content/dam/webassetpool/mam/tag-siemens-com/smdb/regions/united-kingdom/bt-residential-control-documents/bt-residential-control-images/rde100-1dhw.jpg"
              },
              {
                "url": "https://www.siemens.com/uk/en/home/products/buildingtechnologies/residential-controls/temperature-control/_jcr_content/routing/parsys/productroutingitem_340203005/parsys/productroutingteaser/image.adapt.362.high.jpg/rde100-1dhw.jpg"
              }
            ]
          }
        ],
        "visuallySimilarImages": [
          {
            "url": "http://www.tradesuppliesonline.com/images/siemens-rde100-1-7-day-digital-programmable-room-thermostat-p4579-5184_related.jpg"
          }
        ],
        "bestGuessLabels": [
          {
            "label": "siemens rde100.1 7 day digital programmable room thermostat",
            "languageCode": "en"
          }
        ]
      }
    }
  ]
}

Schema:

{
  "type": "object",
  "properties": {
    "responses": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "webDetection": {
            "type": "object",
            "properties": {
              "webEntities": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "entityId": {
                      "type": "string"
                    },
                    "score": {
                      "type": "number"
                    },
                    "description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "entityId",
                    "score",
                    "description"
                  ]
                }
              },
              "fullMatchingImages": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "url"
                  ]
                }
              },
              "partialMatchingImages": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "url"
                  ]
                }
              },
              "pagesWithMatchingImages": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "pageTitle": {
                      "type": "string"
                    },
                    "fullMatchingImages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "url"
                        ]
                      }
                    }
                  },
                  "required": [
                    "url",
                    "pageTitle",
                    "fullMatchingImages"
                  ]
                }
              },
              "visuallySimilarImages": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "url"
                  ]
                }
              },
              "bestGuessLabels": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string"
                    },
                    "languageCode": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "label",
                    "languageCode"
                  ]
                }
              }
            }
          }
        },
        "required": [
          "webDetection"
        ]
      }
    }
  }
}
4 REPLIES 4
Community Support Team
Community Support Team

Re: Limit nested JSON objects in Flow before sending to Powerapps

Hi @spyderbuilt,

 

Could you please explain more details about the get rid of the "responses" level that you mentioned?

Could you please share an example about your requirement?

 

Please share more details so we would try to provide a proper workaround for you.

 

Best regards,

Alice

Administrator
Administrator

Re: Limit nested JSON objects in Flow before sending to Powerapps

Hey, @spyderbuilt!

Thank you for posting on the Flow Community Forum! It appears as though @v-yuazh-msft would like some more information in order to further assist you properly with your issue. Please share any additional information that was requested in order to decrease the amount of time that it will take for you to be assisted!

Thank you for being an active member of the Flow Community!

-Gabriel
Flow Community Manager

-Gabriel
Microsoft Power Automate Community Manager
Are YOU a member of your local Power Automate User Group?
Fill out This Form to claim your Community User Group Member Badge!
spyderbuilt
Level: Powered On

Re: Limit nested JSON objects in Flow before sending to Powerapps

Hi Alice,

 

I am trying to transfer the JSON response back to a collection in Powerapps. If I take the response as is, it creates a structure that is 3 levels deep. Thus when trying to use this response in a Gallery in Powerapps it is restricted to 2 levels. I was wondering if there is a way to flatten this out some and thought by being able to remove the "response" level array that would do the trick.

 

Best,

Lance

Administrator
Administrator

Re: Limit nested JSON objects in Flow before sending to Powerapps

Hello, @v-yuazh-msft!

Thank you for posting a reply to a topic on the Microsoft Flow Community! It appears that the users who you have been engaging in this thread with are now awaiting your reply! Please follow-up on this thread ASAP.

Thank You!

-Gabriel

Microsoft Flow Community Manager

-Gabriel
Microsoft Power Automate Community Manager
Are YOU a member of your local Power Automate User Group?
Fill out This Form to claim your Community User Group Member Badge!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,476)