Sort JSON
Description
Sort a JSON array by specifying a property for efficient data organization and customized sort order.
Input Arguments
Input Argument | Type | Description | Required? | Advanced Option? | Default |
---|---|---|---|---|---|
JSON | String in JSON format | The JSON code | ✔️ | ❌ | - |
Sort property | String | The property name in the JSON objects to sort by (primary key). | ❌ | ❌ | - |
Further sorting property | String | Optional secondary property for sorting if primary keys are equal. | ❌ | ✔️ | Blank |
Reverse order? | Boolean | Whether to sort in descending (true) or ascending (false) order. | ❌ | ✔️ | No |
Output
Response | Type | Description |
---|---|---|
JSON Response | String in JSON format | The 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"
}
]
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!