cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dorothee123
Frequent Visitor

Sort JSON array by key

Hi there,

 

I am using the action "Parse JSON" in my Flow and would like to sort the results by a specific key.

 

So, in the following example I want to sort elements by "SubscriptionName". Can anyone help me to find the correct answer and tell me where to insert by sort function into the following code?

 

Thx in advance

Dorothee

 

{
    "type""array",
    "items": {
        "type""object",
        "properties": {
            "Charge DateDif": {
                "type""integer"
            },
            "ChargeEndDate": {
                "type""string"
            },
            "ChargeStartDate": {
                "type""string"
            },
            "CustomerID": {
                "type""string"
            },
            "Id": {
                "type""string"
            },
            "IdRechnungsnummer": {
                "type""string"
            },
            "MailSent": {
                "type""string"
            },
            "Quantity": {
                "type""integer"
            },
            "Source.Name": {
                "type""string"
            },
            "SubscriptionName": {
                "type""string"
            },
            "VK": {
                "type""number"
            },
            "Auftragsnummer": {
                "type""string"
            },
            "CustomerName": {
                "type""string"
            }
        },
        "required": [
            "Auftragsnummer",
            "Charge DateDif",
            "ChargeEndDate",
            "ChargeStartDate",
            "CustomerID",
            "CustomerName",
            "Id",
            "IdRechnungsnummer",
            "MailSent",
            "Quantity",
            "Source.Name",
            "SubscriptionName",
            "VK"
        ]
    }
}
1 ACCEPTED SOLUTION

Accepted Solutions
v-litu-msft
Community Support
Community Support

Hi @Dorothee123,

 

It's unfortunate insert in order function into the schema is not supported on Power Automate yet.

As a workaround, there is a blog that sorts an array by building an expression:

https://sharepains.com/2019/07/13/sort-an-array-or-collection-in-microsoft-flow/

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-litu-msft
Community Support
Community Support

Hi @Dorothee123,

 

It's unfortunate insert in order function into the schema is not supported on Power Automate yet.

As a workaround, there is a blog that sorts an array by building an expression:

https://sharepains.com/2019/07/13/sort-an-array-or-collection-in-microsoft-flow/

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thanks @v-litu-msft for your quick reply

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (56,490)