Skip to content

Sort#

Use the Sort node to organize lists of items in a desired ordering, or generate a random selection.

Array sort behavior

The Sort operation uses the default JavaScript operation where the elements to be sorted are converted into strings and their values compared. Refer to Mozilla's guide to Array sort to learn more.

Node parameters#

Configure this node using the Type parameter.

Use the dropdown to select how you want to input the sorting from these options.

Simple#

Performs an ascending or descending sort using the selected fields.

When you select this Type:

  • Use the Add Field To Sort By button to input the Field Name.
  • Select whether to use Ascending or Descending order.

Simple options#

When you select Simple as the Type, you have the option to Disable Dot Notation. By default, n8n enables dot notation to reference child fields in the format parent.child. Use this option to disable dot notation (turned on) or to continue using dot (turned off).

Random#

Creates a random order in the list.

Code#

Input custom JavaScript code to perform the sort operation. This is a good option if a simple sort won't meet your needs.

Enter your custom JavaScript code in the Code input field.

Templates and examples#

Automated Web Scraping: email a CSV, save to Google Sheets & Microsoft Excel

by Mihai Farcas

View template details
Get your website indexed by Google automatically

by Eduard

View template details
🦅 Get a bird's-eye view of your n8n instance with the Workflow Dashboard!

by Eduard

View template details
Browse Sort integration templates, or search all templates

Learn more about data structure and data flow in n8n workflows.