---
title: Sort
slug: sort
docTags: 
createdAt: 2023-01-10T12:09:46.000Z
---

Sorts a given JSON List based on a key present in all of the JSON Objects.

&#x20;**direction** can be asc/desc



### API Definition

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://orca.pathfix.com/functions/list/sort",
  "name": "Splice API",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "28UsDqyeH3QRdmtVamSQT",
        "code": "{\n    \"output\": {\n        \"spliced\": [\n            {\n                \"user_id\": \"bruce@pathfix.com\"\n            }\n        ],\n        \"processed\": [\n            {\n\t\t\t\t\"user_id\": \"paul@pathfix.com\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"user_id\": \"chang@pathfix.com\"\n\t\t\t}\n        ]\n    }\n}",
        "language": "200"
      },
      {
        "id": "yIX64DyIuDPJgBRFSfAWb",
        "code": "{\n    \"message\": \"error\"\n}",
        "language": "404"
      }
    ],
    "selectedLanguageId": "28UsDqyeH3QRdmtVamSQT"
  },
  "examples": {
    "languages": [
      {
        "id": "ENcJz9TStG38F0X-taA4x",
        "code": "{\r\n\t\"input\": [\r\n\t\t{\r\n\t\t\t\"user_id\": \"bruce@pathfix.com\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"user_id\": \"paul@pathfix.com\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"user_id\": \"chang@pathfix.com\"\r\n\t\t}\r\n\t],\r\n\t\"key\": \"user_id\",\r\n\t\"direction\": \"asc\"\r\n}",
        "language": "json"
      }
    ],
    "selectedLanguageId": "ENcJz9TStG38F0X-taA4x"
  },
  "description": "\nCall the following API:",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  }
}
```
:::

















