How to filter a JSON object with dynamic keys with Power Automate

preview_player
Показать описание
This video explains how to filter a JSON object in #powerautomate which has dynamic key value pairs. Because the filter array action expects you to know the key name before you can filter on it, this can be difficult to achieve.

This technique is one that I haven't used before so I thought it was interesting to share. The original forum post is here:

Рекомендации по теме
Комментарии
Автор

Hey, thank you for sharing this solution, was really struggling with same problem!(Property names for me were dynamic dataverse IDs which I needed to updated, and keys were True\false values defining if this ID needs an update)

For anyone who would come across this solution I`ll post all formulas down here:

split(trim(body('Create_CSV_table')), decodeUriComponent('%0D%0A'))
range(0, length(split(outputs('Split_CSV')[0], ', ')))
split(outputs('Split_CSV')[0], ', ')[item()]
split(outputs('Split_CSV')[1], ', ')[item()]

tuhan
Автор

Hey, thank you for sharing this! I was scratching my head for a while trying to figure this out, and this is the EXACT solution I needed. I'm needed this exact solution to process the key-value pairs from the "Get changes for an item or a file" action. Thank you! You're very generous.

joel.engelhardt
Автор

Thank you very much Sir.
You have always been one of the most of my favorite channels when I seek solutions for my concerns. I am lucky to know your channel.

nguyenmanhtuan
Автор

Another great vid Paulie, thank you! Will be adding this solution to my toolbox for future use.

EnlightenedOne
Автор

100% like everyone else has said, you are the man sir!

Subbing now

jasonbuchek
Автор

Brilliant solution! Thank you very much for sharing!

joti
Автор

Exactly what i'm looking for, thanks for sharing Paul :)

codelessstudio
Автор

Very slick way of interfacing with this. I hit a snag implementing it since I wanted to expand this to all general JSON objects to key pairs. If any of the values have a comma in then, as you can imagine this craps the bed. Challenge you to find how to escape those inline text commas?

motisko
Автор

Didn't work for me unfortunately. It looks like my outputs contain nested arrays that are also split with comma so not sure how to get around that!

bluric
Автор

Hey, nice video! How could you do to go backwards? I mean, going from that Array to a dynamic key value pairs object? Thanks a lot!

davidezequielmonti
Автор

If i have output of parse jason like this {
data:
{
“data1”:”one”,
“data2”:””,
“data3”:”data3”
}
}

now you can see data two value is just empty “”

so i want to remove data two and want output like this

{
data:
{
“data1”:”one”,
“data3”:”data3”
}
}

how to achieve this for you have any idea?

neeltiwari
Автор

Hello, thank you for sharing. Do you have any suggestions on the following scenario: my json has comments data which mesns that I could have a comma in the text. The comma split doesn't work in this scenario.

matiaskezman
Автор

Great Tutorial, wish it helped with my situation, but unfortunately there are commas inside of the dynamic keys and this throws the split off.

kylecarnaroli
Автор

Will this work with complex JSON that includes Objects and Arrays with objects? I am going to give it a go, but essentially depending on the config of said item, the output of JSON Objects and arrays change continuously. I am trying to work out a method to dynamically update the outputs for all values that do not contain null into a word document. Essentially the end goal is creating documentation for the config itself. If your interested to give it a go, let me know and I can send you a sample of some data I have, but essentially the output will come directly out of a HTTP REST API.

bluric
visit shbcf.ru