cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Collonville
Frequent Visitor

Parse json with several arrays from Flow to Powerapps

Hi, I`m trying to parse JSON object from Microsoft Flow to Powerapps.

A JSON from API server is like this.

{
  "A": [
    "aaa",
    "bbb"
  ],
  "B": [
    "ccc",
    "ddd",
    "eee"
  ],
  "C": [
    "fff",
    "ggg"
  ]
}

 As you can see, it`s consisting of several arrays. I`ve tried the same step of this tutorial --> https://powerapps.microsoft.com/ja-jp/blog/return-an-array-from-flow-to-powerapps-response-method/ but it didn`t work on this type of JSON.
The flow of the Flow is like this. If the button on powerapps was clicked, it will call the API and get the result of JSON. I put a JSON schema in the third block and it didn`t get any errors to run, but the items are empty Powerapps. 
キャプチャ.JPG

 
How can I get items from this type of JSON?

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Collonville,

Could you please share a bit more about the Body Dynamic content (from your HTTP action) you typed within the Body field of the "Response" action in your flow?

Based on the needs that you mentioned, I have made a test on my side, and don't have the issue that you mentioned. The screenshot as below:1.JPG

 

2.JPG

Within the "Initialize variable" action, set the Name to PassedValue, set Type to Object, set the Value to following:

{
  "A": [
    "aaa",
    "bbb"
  ],
  "B": [
    "ccc",
    "ddd",
    "eee"
  ],
  "C": [
    "fff",
    "ggg"
  ]
}

Within the "Response" action, Body field set to PassedValue Dynamic content. Set the Response Body JSON schema field to following:

{
    "type": "object",
    "properties": {
        "A": {
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "B": {
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "C": {
            "type": "array",
            "items": {
                "type": "string"
            }
        }
    }
}

App's configuration as below:3.JPG

The RecordsCollection displayed as below:4.JPG

 

5.JPG

Please check if you have typed proper formula within the Body field of the "Response" action of your flow.

In addition, please also check if you have provided proper JSON schema within the Response Body JSON schema field of the "Response" action.

Note: Please make sure the response value (the value you specified in the Body field of "Response" action) within your "Response" action matches the JSON schema you specified within the the Response Body JSON schema field.

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-xida-msft
Community Support
Community Support

Hi @Collonville,

Could you please share a bit more about the Body Dynamic content (from your HTTP action) you typed within the Body field of the "Response" action in your flow?

Based on the needs that you mentioned, I have made a test on my side, and don't have the issue that you mentioned. The screenshot as below:1.JPG

 

2.JPG

Within the "Initialize variable" action, set the Name to PassedValue, set Type to Object, set the Value to following:

{
  "A": [
    "aaa",
    "bbb"
  ],
  "B": [
    "ccc",
    "ddd",
    "eee"
  ],
  "C": [
    "fff",
    "ggg"
  ]
}

Within the "Response" action, Body field set to PassedValue Dynamic content. Set the Response Body JSON schema field to following:

{
    "type": "object",
    "properties": {
        "A": {
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "B": {
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "C": {
            "type": "array",
            "items": {
                "type": "string"
            }
        }
    }
}

App's configuration as below:3.JPG

The RecordsCollection displayed as below:4.JPG

 

5.JPG

Please check if you have typed proper formula within the Body field of the "Response" action of your flow.

In addition, please also check if you have provided proper JSON schema within the Response Body JSON schema field of the "Response" action.

Note: Please make sure the response value (the value you specified in the Body field of "Response" action) within your "Response" action matches the JSON schema you specified within the the Response Body JSON schema field.

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you @v-xida-msft !

I`ve cheked Body and so on, It has successfully get a data in Powerapps.

Also I want to put these data on dropbox Item like below. But Distinct function showned an error.

It seems have a problem when Collections are nested.

 

DropBox A items = Distinct(RecordsCollection, A)

DropBox B items = Distinct(RecordsCollection, B)

DropBox C items = Distinct(RecordsCollection, C)

Best regards

I found a way to use Lookup function and this the code that I used in dropbox items property

 

LookUp(CollectionRecord.A, true).A

My collections list is not showing my array data in my objects. It is displaying as a single table, instead of data within the fields of the table.

 

image.png

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (3,817)