# How do I sort a JSON response

**URL:** <https://community.postman.com/t/how-do-i-sort-a-json-response/32632>\
**Category:** Help Hub\
**Tags:** scripts, json\
**Created:** [February 15, 2022, 6:01pm UTC](https://community.postman.com/t/how-do-i-sort-a-json-response/32632 "2022-02-15T18:01:01Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![superdupertango](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@superdupertango](https://community.postman.com/u/superdupertango)\
**Post date:** [February 17, 2022, 12:50am UTC](https://community.postman.com/t/how-do-i-sort-a-json-response/32632/5 "2022-02-17T00:50:13Z")

</div>

It should be pretty simple, if this is the ordering that is returned from the server and that shows in the Postman response window:

```auto
{
    "page": 1,
    "per_page": 3,
    "total": 12,
    "total_pages": 4,
    "data": [
        {
            "id": 1,
            "name": "cerulean",
            "year": 2000,
            "color": "#98B2D1",
            "pantone_value": "15-4020"
        },
        {
            "id": 2,
            "name": "fuchsia rose",
            "year": 2001,
            "color": "#C74375",
            "pantone_value": "17-2031"
        },
        {
            "id": 3,
            "name": "true red",
            "year": 2002,
            "color": "#BF1932",
            "pantone_value": "19-1664"
        }
    ],
    "support": {
        "url": "https://reqres.in/#support-heading",
        "text": "To keep ReqRes free, contributions towards server costs are appreciated!"
    }
}

```

the sorted version would look like this:

```auto
{
    "data": [
        {
            "color": "#98B2D1",
            "id": 1,
            "name": "cerulean",
            "pantone_value": "15-4020",
            "year": 2000
        },
        {
            "color": "#C74375",
            "id": 2,
            "name": "fuchsia rose",
            "pantone_value": "17-2031",
            "year": 2001
        },
        {
            "color": "#BF1932",
            "id": 3,
            "name": "true red",
            "pantone_value": "19-1664",
            "year": 2002
        }
    ],
    "page": 1,
    "per_page": 3,
    "support": {
        "text": "To keep ReqRes free, contributions towards server costs are appreciated!",
        "url": "https://reqres.in/#support-heading"
    },
    "total": 12,
    "total_pages": 4
}

```

Thanks!

---

_[View the full topic](https://community.postman.com/t/how-do-i-sort-a-json-response/32632)._
