Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CLI Reference

Complete reference for all jpx command-line options.

Synopsis

jpx [OPTIONS] [EXPRESSIONS]...

Arguments

ArgumentDescription
[EXPRESSIONS]...JMESPath expression(s) to evaluate (multiple are chained as a pipeline)

Options

Input/Output

OptionDescription
-e, --expression <EXPR>Expression(s) to evaluate (can be repeated)
-Q, --query-file <FILE>Read JMESPath expression from file (supports .jpx libraries with colon syntax: file.jpx:query-name)
--query <NAME>Select a named query from a .jpx library
--list-queriesList all queries in a .jpx library file
--checkValidate all queries in a .jpx library without running
-f, --file <FILE>Input JSON file (reads stdin if not provided)
-o, --output <FILE>Output file (writes to stdout if not provided)
-n, --null-inputDon’t read input, use null as input value
-s, --slurpRead all inputs into an array
--streamStream mode - process input line by line (for NDJSON/JSON Lines)

Output Format

OptionDescription
-r, --rawOutput raw strings without quotes
-c, --compactCompact output (no pretty printing)
-y, --yamlOutput as YAML
--tomlOutput as TOML
--csvOutput as CSV (comma-separated values)
--tsvOutput as TSV (tab-separated values)
-l, --linesOutput one JSON value per line
-t, --tableOutput as a formatted table (for arrays of objects)
--table-style <STYLE>Table style: unicode (default), ascii, markdown, plain
--color <MODE>Colorize output: auto, always, never

See Output Formats for detailed examples.

Modes

OptionDescription
--strictStrict mode - only standard JMESPath functions
-v, --verboseShow expression details and timing
-q, --quietSuppress errors and warnings

JSON Patch Operations

OptionDescription
--diff <SOURCE> <TARGET>Generate JSON Patch (RFC 6902) from two files
--patch <PATCH_FILE>Apply JSON Patch (RFC 6902) to input
--merge <MERGE_FILE>Apply JSON Merge Patch (RFC 7396) to input

Data Analysis

OptionDescription
--statsShow statistics about the input data
--pathsList all paths in the input JSON
--typesShow types alongside paths (use with --paths)
--valuesShow values alongside paths (use with --paths)

Benchmarking

OptionDescription
--bench [N]Benchmark expression performance (default: 100 iterations)
--warmup <N>Number of warmup iterations before benchmarking (default: 5)

Function Discovery

OptionDescription
--list-functionsList all available functions
--list-category <NAME>List functions in a specific category
--describe <FUNCTION>Show detailed info for a function
--search <QUERY>Search functions by name, description, or category (fuzzy matching)
--similar <FUNCTION>Find functions similar to the specified function

Debugging

OptionDescription
--explainShow how an expression is parsed (AST)
--debugShow diagnostic information for troubleshooting

Interactive Mode

OptionDescription
--replStart interactive REPL mode
--demo <NAME>Load a demo dataset (use with --repl)

Other

OptionDescription
--completions <SHELL>Generate shell completions (bash, zsh, fish, powershell, elvish)
-h, --helpPrint help
-V, --versionPrint version

Environment Variables

VariableDescription
JPX_VERBOSE=1Enable verbose mode
JPX_QUIET=1Enable quiet mode
JPX_STRICT=1Enable strict mode
JPX_RAW=1Output raw strings
JPX_COMPACT=1Compact output

Environment variables are overridden by command-line flags.

Quick Examples

A few examples showing common flag combinations. For comprehensive examples, see:

# Query a file, raw output for scripting
jpx -r 'config.api_key' -f settings.json

# Chain expressions, table output
jpx 'users' '[?active]' -t -f data.json

# Stream NDJSON, filter errors
cat logs.ndjson | jpx --stream '[?level == `"error"`]'

# Analyze structure before querying
jpx --paths --types -f data.json

# Find functions by keyword
jpx --search unique

# Run a named query from a library
jpx -Q queries.jpx:active-users -f data.json

Exit Codes

CodeMeaning
0Success
1Error (invalid expression, file not found, etc.)