# Sort List

> Put a list in order by the whole item or by a field such as score or created_at, comparing as text, numbers or dates, ascending or descending.

Source: https://nodaro.ai/docs/nodes/automate/sort-list

The **Sort List** node puts the items of a list in order. Sort the whole items, or sort by a field inside each item, such as `score` or `created_at`. You choose whether the values compare as text, numbers or dates, and whether the order is ascending or descending. The node is free.

- Found in: Automate › Lists & Batching
- Output: data
- API type: `sort-list`

## When to use it
- Order scraped posts by likes, highest first, and keep the top three with [Selector](https://nodaro.ai/docs/nodes/automate/selector).
- Order feed items by date, newest first.
- Put a list of names in alphabetical order.

## Quick start
### Add the node

Press Tab on the canvas and choose **Automate › Lists & Batching › Sort List**.

### Connect a list

Wire a list into the **List** input, for example from [Web Scrape](https://nodaro.ai/docs/nodes/automate/web-scrape), [List](https://nodaro.ai/docs/nodes/automate/list), [Split Text](https://nodaro.ai/docs/nodes/automate/split-text) or [Filter List](https://nodaro.ai/docs/nodes/automate/filter-list).

### Choose how to sort

Open the settings panel. Choose **Sort by field**, **Sort type** and **Direction**.

### Run it

The **Sorted** output carries the list in its new order. After a run, the panel previews the first items.

Workflow: Sort List orders the posts by likes, Selector keeps the top three, and Prompt runs once for each of them.

- Instagram → Sort List (list)
- Sort List → Selector (list)
- Selector → Prompt (picked · Each)

## Inputs and outputs
| Input or output | Accepts or sends | What it does |
| --- | --- | --- |
| **List** | A list of text or JSON items | The list to sort. |
| **Sorted** | A list | The same items in the new order. |

## Settings
| Setting | What it does |
| --- | --- |
| **Sort by field** | What to compare. **(whole item)**, the default, compares the full items. Choose a field detected from the upstream data, or **Custom path…** to type a dot path such as `score` or `created_at`. Each item is read as JSON when the path matches it. |
| **Sort type** | How to compare. **Auto (detect)**, the default, tries **Number**, then **Date**, then **Text**. Choose **Text**, **Number** or **Date** for a fixed comparison. |
| **Direction** | **Ascending**, the default, or **Descending**. Items with a missing or invalid value always appear last, in both directions. |

## Credits
Sort List is free.

## Tips
- **Top N items.** Follow Sort List with a [Selector](https://nodaro.ai/docs/nodes/automate/selector) in **Range** mode from `1` to `N`.
- **Fix the type for repeatable runs.** **Auto (detect)** decides from the values it receives. Choose **Text**, **Number** or **Date** when every run must sort the same way.
- **Remove repeats too.** Use [Remove Duplicates](https://nodaro.ai/docs/nodes/automate/remove-duplicates) before or after sorting to drop repeated items.

## Frequently asked questions

### How do I sort a list of scraped items by one of their fields?

Set Sort by field to the field, or choose Custom path… and type a dot path such as stats.likes. Each item is read as JSON when the path matches it.

### Where do items without a value end up?

Items with a missing or invalid value always go last, in ascending and in descending order.

### What does the Auto sort type do?

Auto tries to compare the values as numbers, then as dates, then as text. Choose Text, Number or Date when you need the same order on every run.

### Does Sort List cost credits?

No. Sort List is free.
