Skip to content

JSON: Filter

Filters JSON data based on a key/value condition. Expects a list (array) of objects and returns only the objects that match the comparison rule. Supports equals, contains, starts_with, and ends_with comparisons.
Preview

Usage

Use this node to select a subset of objects from JSON data by matching a specific field against a target value. Typically placed after nodes that produce or transform JSON arrays, and before nodes that consume the filtered results.

Inputs

FieldRequiredTypeDescriptionExample
json_dataTrueWILDCARDJSON data to filter. Should be a list (array) of objects. If a string is provided, the node will attempt to parse it as JSON.[{"name":"Alice"},{"name":"Bob"}]
filter_keyTrueSTRINGThe object key (field name) to evaluate for each item in the array.name
filter_valueTrueWILDCARDThe value to compare against the item's field. For contains/starts_with/ends_with, comparisons are done as strings.Al
filter_modeTrue["equals", "contains", "starts_with", "ends_with"]How to compare the item's field value with filter_value.starts_with

Outputs

FieldTypeDescriptionExample
filtered_dataWILDCARDFiltered JSON data. If input is a list of objects, returns a list containing only matching objects. In non-list cases or on error, returns the original input.[{"name":"Alice"}]

Important Notes

  • Input parsing: If json_data is a string, the node attempts to parse it as JSON.
  • List required: Actual filtering occurs only when json_data is a list (array). Otherwise, the original data is returned unmodified.
  • Empty key handling: If filter_key is empty, the original data is returned.
  • Comparison behavior: equals uses direct equality. contains, starts_with, and ends_with compare string forms of the values.
  • Missing keys: Objects that do not contain the specified filter_key are ignored (not included in the output).
  • Error handling: On exceptions, the node returns the original json_data.

Troubleshooting

  • No items returned: Verify that json_data is a list of objects and that each object contains the specified filter_key.
  • Unexpected unfiltered output: Ensure json_data is a list. If it is a single object or another type, the node returns it unchanged.
  • Contains/starts/ends not matching numeric/boolean fields: These modes compare string representations. Confirm the string form matches your expectation.
  • Invalid JSON string input: If providing a string, ensure it is valid JSON. Invalid strings will cause the node to return the original input.
  • Equals not matching: Check for exact type/value equality (e.g., number 1 vs string "1"). Use contains/starts_with/ends_with if appropriate.