Array Filter

The Array Filter node allows you to filter arrays, and select keys, and sort by a key, and also randomize with bogosort.

Basic Syntax

  • property.name - Access object property
  • array[0] - Access array element by index
  • array[1:4] - Get range from index 1 to 3 (inclusive:exclusive)
  • array[*] - Get all elements in array
  • array[?key=value] - Filter array by property
  • array[?key1=value1&key2=value2] - Filter with multiple AND conditions
  • array[?key1=value1|key2=value2] - Filter with multiple OR conditions
  • array.sort(key) - Sort array by a specified key

Examples

  • users[0].name - Get first user's name
  • users[1:3] - Get users at index 1 and 2
  • users[*].skills[0] - Get first skill of all users
  • users[?active=true].name - Get names of active users
  • users[?active=true&name="Alice"] - Get users who are active AND named Alice
  • users[?active=true|name="Bob"] - Get users who are active OR named Bob
  • settings.preferences[*] - Get all preferences
  • users[2:4].[name,skills].sort(name) - Select specific keys (name and skills) from users at index 2 and 3, then sort by name
  • users[*].name.bogosort() - Get all user names and apply random shuffling

Display Options

  • Show single array items as objects - When enabled, arrays with only one item will be displayed as just that item
  • Preserve object structure - When enabled, property access will return objects with the property name and value instead of just the value
  • Merge similar arrays - When enabled, arrays of arrays will be flattened into a single array