cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

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
Solution Sage
Solution Sage

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
Solution Sage
Solution Sage

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
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Top Kudoed Authors
Users online (6,090)