cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Solution Sage
Solution Sage

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

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Top Kudoed Authors
Users online (4,484)