cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dilipvyas
Level: Power Up

Extract data from Json Array using MS Flow

Anyone have an idea how to  achieve below issue in  Flow

 

 

{
    "fields": [
        {
            "field": "field1",
            "type": "string"
        },
        {
            "field": "field2",
            "type": "string"
        },
        {
            "field": "field3",
            "type": "integer"
        },
        {
            "field": "eventTimestamp",
            "type": "date"
        }
    ],
    "results": [
        [
            "field1value1",
            "field2value1",
            10,
            "2018-05-31T22:55:31.187+0000"
        ],
        [
            "field1value2",
            "field2value2",
            20,
            "2018-05-31T22:55:31.187+0000"
        ],
        [
            "field1value3",
            "field2value3",
            30,
            "2018-05-31T22:55:31.187+0000"
        ]
    ]
}

 

My goal is to parse this data into dataset shaped like that with as the following table:

field1          field2          field3      eventTimestamp
field1value1    field2value1    10          2018-05-31T22:55:31.187+0000
field1value2    field2value2    20          2018-05-31T22:55:31.187+0000
field1value3    field2value3    30          2018-05-31T22:55:31.187+0000
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
v-zhos-msft
Level 10

Re: Extract data from Json Array using MS Flow

Hi @dilipvyas ,

I have made a flow for your scenario, please check it for a reference:

The value in the 'Compose' is the Json you provided.

The expression 'Compose 2' to 'Compose5' are:

outputs('Compose')?['fields']
outputs('Compose')?['results']
length(outputs('Compose_2'))
length(outputs('Compose_3'))
The output in 'Do Until 2' is Compose 4.
The expression in 'Append to array variable 2' is:
outputs('Compose_2')?[variables('length')]?['field']
The output in 'Do Until' is Compose 5.
The expression in 'Append to array variable' are:
{
"outputs('Compose_6')?[0]" : outputs('Compose_3')?[variables('index')]?[0],
"outputs('Compose_6')?[1]" : outputs('Compose_3')?[variables('index')]?[1],
"outputs('Compose_6')?[2]" : outputs('Compose_3')?[variables('index')]?[2],
"outputs('Compose_6')?[3]" : outputs('Compose_3')?[variables('index')]?[3]
}
 

 

Capture3.PNGCapture4.PNGCapture5.PNGCapture6.PNGCapture7.PNG

Capture8.PNG

Best Regards,

Community Support Team _ Zhongys

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

1 REPLY 1
Highlighted
v-zhos-msft
Level 10

Re: Extract data from Json Array using MS Flow

Hi @dilipvyas ,

I have made a flow for your scenario, please check it for a reference:

The value in the 'Compose' is the Json you provided.

The expression 'Compose 2' to 'Compose5' are:

outputs('Compose')?['fields']
outputs('Compose')?['results']
length(outputs('Compose_2'))
length(outputs('Compose_3'))
The output in 'Do Until 2' is Compose 4.
The expression in 'Append to array variable 2' is:
outputs('Compose_2')?[variables('length')]?['field']
The output in 'Do Until' is Compose 5.
The expression in 'Append to array variable' are:
{
"outputs('Compose_6')?[0]" : outputs('Compose_3')?[variables('index')]?[0],
"outputs('Compose_6')?[1]" : outputs('Compose_3')?[variables('index')]?[1],
"outputs('Compose_6')?[2]" : outputs('Compose_3')?[variables('index')]?[2],
"outputs('Compose_6')?[3]" : outputs('Compose_3')?[variables('index')]?[3]
}
 

 

Capture3.PNGCapture4.PNGCapture5.PNGCapture6.PNGCapture7.PNG

Capture8.PNG

Best Regards,

Community Support Team _ Zhongys

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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 300 members 5,832 guests
Please welcome our newest community members: