cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
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

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (11,963)