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

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 Team
Community Support Team

Re: Parse json with several arrays from Flow to Powerapps

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.
4 REPLIES 4
Community Support Team
Community Support Team

Re: Parse json with several arrays from Flow to Powerapps

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.
Collonville
Level: Powered On

Re: Parse json with several arrays from Flow to Powerapps

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

Collonville
Level: Powered On

Re: Parse json with several arrays from Flow to Powerapps

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

 

LookUp(CollectionRecord.A, true).A
mysticode
Level: Powered On

Re: Parse json with several arrays from Flow to Powerapps

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
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 271 members 3,784 guests
Please welcome our newest community members: