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

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.

View solution in original post

4 REPLIES 4
Highlighted
Community Support
Community Support

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.

View solution in original post

Highlighted
Frequent Visitor

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

Highlighted
Frequent Visitor

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
Highlighted
Frequent Visitor

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
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,497)