# Checking sorting in object

**URL:** <https://community.postman.com/t/checking-sorting-in-object/38498>\
**Category:** Help Hub\
**Created:** [August 24, 2022, 10:11am UTC](https://community.postman.com/t/checking-sorting-in-object/38498 "2022-08-24T10:11:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lunar-module-meteor3](https://avatars.discourse-cdn.com/v4/letter/l/7feea3/32.png) [@lunar-module-meteor3](https://community.postman.com/u/lunar-module-meteor3)\
**Post date:** [August 24, 2022, 10:11am UTC](https://community.postman.com/t/checking-sorting-in-object/38498/1 "2022-08-24T10:11:13Z")

</div>

Hello everybody,

I’m trying to find a solution on how to check sorting/ordering in a similar response:

```auto
{
    "30": [
        {
            "Number": 1
        }
    ],
    "40": [
        {
            "Number": 2
        }
    ],
    "20": [
        {
            "Number": 3
        }
    ]
}

```

A response should be sorted by “Number” value in ascending order.

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [August 25, 2022, 12:10pm UTC](https://community.postman.com/t/checking-sorting-in-object/38498/2 "2022-08-25T12:10:29Z")

</div>

That is fairly easy with an array.

```auto
var array = [
                ["30", 1],
                ["40", 2],
                ["20", 3],
            ];
var sorted = array.sort((a, b) => b[1] - a[1]);
console.log(sorted);

```

I’ve sorted it in descending order, as your data was already in ascending order.

I’ve tried importing your data\object into an array and my Javascript skills are failing me.  
I’m looking it up now. If I find out how to do it properly, I’ll update here.
