Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Parse dynamic JSON

(0) ShareShare
ReportReport
Posted on 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 at
    Re: Parse dynamic JSON

    this is BRILLIANT! Thank you

  • Verified answer
    Chriddle Profile Picture
    7,922 Super User 2025 Season 1 on at
    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 at
    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 at
    Re: Parse dynamic JSON

    agree, i tried that

  • v-bofeng-msft Profile Picture
    on at
    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,041 Super User 2025 Season 1 on at
    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

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!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1