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.

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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,292)