gojq
github.com
What it is
gojq is a free, MIT-licensed Go implementation of the jq command, with a library for embedding queries in Go products. The command-line tool applies jq-style queries to JSON, including filtering, field selection, updates, and multiple input values. It reads YAML and can produce YAML output. Integer arithmetic uses arbitrary precision for addition, subtraction, multiplication, modulo, and divisible division. The project describes gojq as portable and supports Linux, macOS, Windows, and self-hosted use. Documented installation routes include Homebrew, mise, Zero Install, source builds, and Docker images. Go applications can parse and run queries, compile them for reuse, and configure custom functions and iterators. Environment-variable access and module loading are disabled by default for library queries and require configured loaders. gojq does not preserve object key order and lacks some jq extensions, flags, functions, and regular-expression behavior.
Spec sheet
- Purpose
- gojq is a pure Go implementation of the jq command-line JSON processor and can also be embedded as a library in Go products.Read 11 Oct 2026 · github.com
- Support
- The project directs users to report bugs through its GitHub Issues page.Read 11 Oct 2026 · github.com
- License
- The project is released under the MIT License.Read 11 Oct 2026 · github.com
- Compatibility limits
- gojq does not preserve object key order and lacks jq's keys_unsorted function and --sort-keys option.Read 11 Oct 2026 · github.com
- Environment access
- For library use, OS environment variables are inaccessible to queries by default for security reasons and can be enabled with a configured environment loader.Read 4 Oct 2026 · github.com
- Execution limits
- Library queries may emit infinitely many values or run without producing output, and the README recommends RunWithContext to limit execution time.Read 4 Oct 2026 · github.com
- Install options
- The project documents installation through Homebrew, mise, Zero Install, go install, and Docker.Read 11 Oct 2026 · github.com
- JSON queries
- The command applies jq queries to JSON input, including filtering, field selection, and updates.Read 4 Oct 2026 · github.com
- Library integration
- Go applications can parse and run queries with gojq, compile queries for reuse, and configure custom functions and iterators.Read 4 Oct 2026 · github.com
- Library limits
- The library requires query inputs to use []any for arrays and map[string]any for maps, and warns that queries can produce infinite results or run without producing output.Read 11 Oct 2026 · github.com
- Library security
- For library use, OS environment variables are inaccessible to queries by default; a caller can configure an environment loader.Read 11 Oct 2026 · github.com
- Limits
- gojq does not preserve object key order and therefore does not provide the keys_unsorted function or the --sort-keys option.Read 4 Oct 2026 · github.com
- Module loading
- The library's module feature is disabled by default and can be configured with a module loader.Read 4 Oct 2026 · github.com
- Number precision
- gojq supports arbitrary-precision integer calculations for addition, subtraction, multiplication, modulo, and divisible division.Read 4 Oct 2026 · github.com
- Numbers
- gojq supports arbitrary-precision integer calculations, while mathematical functions such as floor and round convert integers to floating-point numbers.Read 11 Oct 2026 · github.com
- Other limits
- The README lists unsupported jq features, including some functions and flags, JSON extensions such as NaN and Infinity, and some regular-expression features.Read 11 Oct 2026 · github.com
- Portability
- The README describes gojq as implemented purely in Go and completely portable.Read 11 Oct 2026 · github.com
- Queries
- The CLI runs jq-style queries against JSON input and supports multiple input values.Read 11 Oct 2026 · github.com
- YAML
- gojq supports YAML input with --yaml-input and YAML output with --yaml-output.Read 11 Oct 2026 · github.com
Plans and prices
Strong points and limits
Strong points
- Free MIT-licensed software
- JSON and YAML input/output
- Arbitrary-precision integer calculations
- Embeddable Go library
- Portable across major desktop platforms
Limits
- Object key order is not preserved
- Some jq extensions and flags are unsupported
- Library queries may run indefinitely
- Environment access is disabled by default
Who it suits
It suits command-line users needing jq-style JSON or YAML queries and Go developers embedding query execution. Self-hosted installations are supported across Linux, macOS, and Windows.
Verdict
gojq offers portable jq-compatible querying with a Go library and YAML support. Review its compatibility and execution limits before replacing jq or embedding unbounded queries.
Where Specifiction places it
- JSON Tools#5 of 298.5