> For the complete documentation index, see [llms.txt](https://docs.cosmocloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cosmocloud.io/flow-builder/node-types/variable-nodes/arrays/sort-array.md).

# Sort array

The **Sort array** node is  used to sort array in either ascending or descending order.

### Properties Panel

#### General

<table data-full-width="false"><thead><tr><th width="244">Field</th><th>Description</th><th>Required</th><th data-hidden>Default</th></tr></thead><tbody><tr><td>Node name</td><td><a href="/pages/jJ1qO0Ju8d7VFyPB2Jy3"><mark style="color:blue;"><strong>Checkout Node name</strong></mark></a></td><td>true</td><td>_</td></tr><tr><td>Variable name</td><td>Variable name to store result</td><td>true</td><td>_</td></tr><tr><td>Array to sort</td><td>Values to sort</td><td>true</td><td></td></tr><tr><td>Key to sort by</td><td>Key to sort array by </td><td>false</td><td></td></tr><tr><td>Sort order</td><td>Ascending or Descending</td><td>false</td><td></td></tr></tbody></table>

### Conditional fields

**Key to sort by :**  This field is required if array to sort have dict/object values. e.g.

```javascript
[
  {
    name: "john",
    age:20
  },
  ...
]
```

If you want to sort this list based of age then you can specify `Key to sort by` as `age` &#x20;

### Returns

This node does not return any values but create a new variables with result . You can access it using magical autocomplete using `$.variables.<Variable name>`
