web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : tcPp/W5aL4HeOBHkNIwuX2
Power Automate - Building Flows
Answered

Parse dynamic JSON

Like (0) ShareShare
ReportReport
Posted on 2 Nov 2023 20:28:54 by 274

I need to extract the list of property names from a dynamic json string. The following is a simplified version. How can I get an array of ["xxxxxxx","zzzzzzzzzzzzz"]

{
    "xxxxxxx": {
        "property redacted": "removed"
    },
    "zzzzzzzzzzzzz": {
        "content redacted": "removed"
    }
}
  • darylvogan Profile Picture
    274 on 03 Nov 2023 at 17:25:50
    Re: Parse dynamic JSON

    this is BRILLIANT! Thank you

  • Verified answer
    Chriddle Profile Picture
    7,932 Super User 2025 Season 2 on 03 Nov 2023 at 17:10:38
    Re: Parse dynamic JSON

    Don't do this with string operations ðŸ˜£

     

    Chriddle_0-1699031000267.png

    Compose: Your flow's JSON

    Select From:

    xpath(
    	xml(json(concat('{"root":', outputs('Compose'),'}}'))),
    	'/root/*'
    )

    Select Map:

    xpath(
    	item(),
    	'name(/*)'
    )

    Only downside: You might have to handle XML encoding of characters that are not allowed as node names.

     

     

    Output:

    Chriddle_1-1699031122469.png

     

  • darylvogan Profile Picture
    274 on 03 Nov 2023 at 15:49:12
    Re: Parse dynamic JSON

    This is a good start. There was a lot more to the json that I redacted. That extra content makes the 

    take(split(string(variables('DynamicJSON')),'}'),sub(length(split(string(variables('DynamicJSON')),'}')),2))

    result in a lot more elements, that are still hard to parse. Here is the complete string, but i altered the data.

    I really appreciate the assistance!!!!!!!!

    {
    "Get_items": {
    "runAfter": {},
    "metadata": {
    "operationMetadataId": ""
    },
    "type": "OpenApiConnection",
    "inputs": {
    "host": {
    "connectionName": "",
    "operationId": "",
    "apiId": ""
    },
    "parameters": {
    "dataset": "",
    "table": ""
    },
    "authentication": ""
    }
    },
    "Get_items_2": {
    "runAfter": {
    "Get_items": [
    "Succeeded"
    ]
    },
    "metadata": {
    "operationMetadataId": ""
    },
    "type": "",
    "inputs": {
    "host": {
    "connectionName": "",
    "operationId": "",
    "apiId": ""
    },
    "parameters": {
    "dataset": "",
    "table": ""
    },
    "authentication": ""
    }
    }
    }

  • darylvogan Profile Picture
    274 on 03 Nov 2023 at 15:36:37
    Re: Parse dynamic JSON

    agree, i tried that

  • v-bofeng-msft Profile Picture
    on 03 Nov 2023 at 01:29:44
    Re: Parse dynamic JSON

    Hi @darylvogan ,

     

    I've made a test for your reference:

    vbofengmsft_1-1698974957204.png

    1)

    take(split(string(variables('DynamicJSON')),'}'),sub(length(split(string(variables('DynamicJSON')),'}')),2))

    2)

    split(split(item(),'"')[1],'"')[0]

     

    Result

    vbofengmsft_0-1698974919751.png

    Best Regards,

    Bof

     

  • lbendlin Profile Picture
    8,081 Super User 2025 Season 2 on 03 Nov 2023 at 01:00:21
    Re: Parse dynamic JSON

    replace the outer { and }  with [ and ]

     

    Edit: no, doesn't work.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete