Sort JSON

Sort JSON

Description

Sort a JSON array by specifying a property for efficient data organization and customized sort order.

Input Arguments

Input ArgumentTypeDescriptionRequired?Advanced Option?Default
JSONString in JSON formatThe JSON code✔️-
Sort propertyStringThe property name in the JSON objects to sort by (primary key).-
Further sorting propertyStringOptional secondary property for sorting if primary keys are equal.✔️Blank
Reverse order?BooleanWhether to sort in descending (true) or ascending (false) order.✔️No

Output

ResponseTypeDescription
JSON ResponseString in JSON formatThe sorted JSON code.

Power Automate Examples

Sort JSON

We use a JSON describing pets and some attributes.

Simple JSON with four pets
[
{
"Pet": "Dog",
"Identifier": "1006",
"First name": "Eats",
"Last name": "A Lot"
},
{
"Pet": "Cat",
"Identifier": "1010",
"First name": "Likes",
"Last name": "To Scratch"
},
{
"Pet": "Cat",
"Identifier": "1002",
"First name": "Furry",
"Last name": "Kitty"
},
{
"Pet": "Duck",
"Identifier": "1002",
"First name": "Dagobert",
"Last name": "Swimmy"
}
]

Picture

As options you can choose the sort property, a further sort property and decide if you want to sort it in reversed order.

💡

Looking for the response to this example? Scroll up to see the Output tab.

Known Limitations

⚠️
If you experienced other limitations please get in touch with us!