| name | jpx-cli |
| description | Run jpx to query and transform JSON from the command line. Covers output formats (CSV, TSV, table, YAML), streaming NDJSON, input modes (slurp, raw-input, null-input), query files, variable binding, and shell pipelines. Use when building shell pipelines or exporting JSON data. |
| license | MIT OR Apache-2.0 |
| metadata | {"author":"joshrotenberg","version":"1.0"} |
| allowed-tools | Bash(jpx:*) |
jpx CLI Usage Guide
jpx is a JMESPath CLI with 460+ extended functions. It reads JSON, applies expressions, and outputs results in multiple formats.
Basic Usage
echo '{"name":"alice"}' | jpx 'name'
jpx 'users[*].name' data.json
jpx -f data.json 'users[*].name'
jpx -n 'now()'
jpx '[*].name' 'sort(@)' '[0]' data.json
jpx -e '[*].name' -e 'sort(@)' -e '[0]' -f data.json
Output Formats
JSON (default)
jpx 'expression' data.json
jpx -c 'expression' data.json
jpx --indent 4 'expression' data.json
jpx --tab 'expression' data.json
jpx -S 'expression' data.json
jpx --color never 'expression' data.json
Raw strings
jpx -r 'name' data.json
jpx -j 'name' data.json
CSV / TSV
jpx --csv 'users[*]' data.json
jpx --tsv 'users[*]' data.json
Table
jpx -t 'users[*]' data.json
jpx -t --table-style ascii 'users[*]' data.json
YAML / TOML
jpx -y 'config' data.json
jpx --toml 'config' data.json
Lines (NDJSON)
jpx -l 'users[*]' data.json
Output to file
jpx -o result.json 'expression' data.json
jpx --csv -o data.csv 'users[*]' data.json
Input Modes
Slurp (-s)
Combine multiple JSON values from stdin into a single array:
echo -e '{"id":1}\n{"id":2}\n{"id":3}' | jpx -s 'length(@)'
Raw input (-R)
Read each line as a JSON string (not parsed as JSON):
echo -e "hello\nworld" | jpx -R -s '[*] | sort(@)'
Null input (-n)
Use null as input, don't read stdin:
jpx -n 'now()'
jpx -n 'range(`1`, `11`)'
jpx -n 'uuid()'
Streaming Mode
Process NDJSON line by line with constant memory:
cat events.ndjson | jpx --stream 'user.name'
cat events.ndjson | jpx --stream '[?level == `error`] | [0]'
cat events.ndjson | jpx --stream --csv '{user: user.name, action: event}'
cat events.ndjson | jpx --stream --tsv '@'
tail -f events.ndjson | jpx --stream --unbuffered 'message'
Note: --stream is incompatible with --table, --yaml, --toml, and --lines (these need the full dataset). Use --slurp instead if you need those formats.
See references/streaming.md for more streaming patterns.
Variable Binding
Bind variables for use in expressions:
jpx --arg name Alice '[?name == $name]' data.json
jpx --argjson threshold 42 '[?score > $threshold]' data.json
jpx --argjson ids '[1,2,3]' '[?contains($ids, id)]' data.json
Query Files
Save and reuse expressions with .jpx query files:
jpx -Q queries.jpx:active-users data.json
jpx -Q queries.jpx --query active-users data.json
jpx -Q queries.jpx --list-queries
jpx -Q queries.jpx --check
See references/query-files.md for the .jpx file format.
Function Discovery
jpx --list-functions
jpx --list-category String
jpx --describe format_date
jpx --search "date format"
jpx --similar group_by
Data Inspection
jpx --stats -f data.json
jpx --paths -f data.json
jpx --paths --types -f data.json
jpx --paths --values -f data.json
JSON Operations
jpx --diff before.json after.json
jpx --patch changes.json -f original.json
jpx --merge overlay.json -f base.json
Other Features
jpx --explain 'sort_by([*], &name) | [0]'
jpx --bench 1000 'complex.expression' data.json
jpx --repl -f data.json
jpx --repl --demo users
jpx -x '[?critical]' data.json && echo "found critical items"
Shell Pipeline Recipes
curl -s https://api.example.com/users | jpx -t '[*].{name: name, email: email}'
cat app.log | jpx --stream -s '[*]' | jpx 'group_by(@, &error_type)'
jpx --csv 'records[*]' -o export.csv data.json
jpx 'dependencies | keys(@) | sort(@)' package.json
Related Skills