Updated Sep 21, 2026

Utilities

Filter and reshape JSON with jq

Turn one JSON document into the exact records the next node needs.

Agent

overview

What jq does

Connect a JSON file, enter a jq filter, and the node writes jq's stdout to a workflow output file. The filter is positional, so expressions such as .items[] or map(select(.enabled)) work as they do in the jq CLI.

-r writes strings without JSON quotes, -c emits one compact value per line, -s collects all inputs into an array, and -R reads lines as strings. Leave modes disconnected unless the filter needs them.

The wrapper writes through a temporary file and only publishes the result after jq exits successfully. A syntax error or malformed input fails the node instead of leaving a partial artifact.

source github.com/jqlang/jq

use cases

Where jq fits

Select fields

Project large records into a smaller object before passing them downstream.

Filter arrays

Keep records that match a condition and discard the rest.

Convert JSON to text

Use -r when the next node expects newline-delimited strings rather than JSON strings.

reference

jq inputs and flags

6 inputs
NameTypeFlagDescription
filterSTRING--filterjq expression to evaluate.
inputFILE--inputJSON input file.
raw-outputBOOLEAN--raw-outputWrite strings without JSON quoting.
compactBOOLEAN--compactWrite compact JSON.

Showing key inputs. jq exposes 6 inputs in total.

Full flag reference (6 inputs)
NameTypeFlagDescription
raw-outputBOOLEAN--raw-outputWrite strings without JSON quoting
compactBOOLEAN--compactWrite compact JSON
slurpBOOLEAN--slurpRead all input values into one array
raw-inputBOOLEAN--raw-inputRead each input line as a string
filterSTRING--filterjq filter expression
inputFILE--inputJSON input file

example

Run jq

jq · command
jq -c '.items[] | {name, doubled: (.n * 2)}' input.json
sample output
{"name":"alpha","doubled":4}{"name":"beta","doubled":6}

guidance

Choosing jq

Use jq when the input is JSON and the transformation fits a jq expression. Use yq for YAML, XML, or TOML, and Miller for record-oriented CSV work.

yq

Queries YAML, XML, TOML, and JSON with a jq-like expression language.

miller

Transforms CSV and other record-oriented formats with named verbs.

duckdb

Runs SQL over larger JSON, CSV, and Parquet datasets.

faq

jq questions

Set filter to the jq expression. It is passed before the input file, matching jq's normal CLI order.

Run jq yourself

A two-record JSON fixture feeds jq, which calculates a doubled field and writes compact JSON objects.

Facts on this page come from the live Trickest tool library.