ajson
Query and manipulate JSON data
TLDR
Read JSON from a file and execute a specified JSONPath expression
Read JSON from stdin and execute a specified JSONPath expression
Read JSON from a URL and evaluate a specified JSONPath expression
Read some simple JSON and calculate a value
SYNOPSIS
ajson [OPTION]... <filter> [file...]
ajson [OPTION]... --arg name value [name value...] <filter> [file...]
PARAMETERS
-h, --help
Display help and exit
-V, --version
Output version information
-n, --null-input
Use null input instead of reading file
-s, --slurp
Read entire input into single array
-r, --raw-output
Output strings without quotes
-c, --color-output
Colorize output
--unbuffered
Flush output after each record
--arg
Define variable from command-line
--argjson
Define JSON variable from string
--slurpfile
Slurp file contents into variable
--stream
Parse in streaming fashion
--seq
Wrap filtered output in array
DESCRIPTION
ajson is a high-performance command-line tool for parsing, filtering, and transforming JSON data.
Written in Zig, it offers jq-like syntax and semantics while achieving significantly higher speeds—up to 10x faster than jq on large datasets.
It supports common operations like selecting fields (.field), array slicing, object merging, and complex pipes. Ideal for log processing, API data manipulation, and DevOps scripts.
Key strengths include low memory usage, streaming support for huge files, and native binary distribution. Unlike jq, it compiles filters at runtime for efficiency.
ajson reads JSON from files or stdin, applies user-defined filters, and outputs formatted or raw results. It's cross-platform (Linux, macOS, Windows) and lightweight (~1MB binary).
While highly compatible with jq, some advanced modules may lack support. Perfect for users needing jq power without performance overhead.
CAVEATS
Not 100% jq compatible; some esoteric features/modules unsupported. Best on Linux x86_64. Streaming mode may alter output order.
INSTALLATION
Via prebuilt binaries from GitHub releases or build from source: zig build -Drelease-safe.
EXAMPLE
ajson '.users[].name' data.json
Extract names from users array.
HISTORY
Developed by Vladimir Vivkin in 2023 using Zig. Inspired by jq limitations on speed. v0.1.0 released Oct 2023; active development with benchmarks vs jq.


