Skip to the content
Know your tech before you buy it. Makers: get listed from $49/mo

gojq

github.com

  • Free plan
  • Windows
  • macOS
  • Linux
  • Self-hosted
7.9 Club score Visit github.com

What gojq is

gojq is a pure Go implementation of the jq command for querying JSON, and Go products can embed it as a library. The command line applies jq-style queries to JSON, including filtering, selecting fields, and updating data; it can handle multiple input values. gojq also reads and writes YAML. Its integer calculations support arbitrary precision for addition, subtraction, multiplication, modulo, and divisible division, although mathematical functions such as floor and round convert integers to floating point. The project describes it as portable and documents installation through Homebrew, mise, Zero Install, source builds, and Docker images. In Go applications, developers can parse and run queries, compile queries for reuse, and configure custom functions and iterators. For embedded use, environment access and module loading are disabled unless configured. There are jq compatibility limits: object key order is not preserved, some number extensions and regular-expression syntax are unsupported, and some functions and flags are absent. Library queries can run indefinitely or without output; the project recommends RunWithContext to limit execution time. gojq is MIT licensed.

Who it suits

It suits command-line users who need jq-style queries over JSON or YAML, and Go developers who want query support inside an application. Check the compatibility gaps if replacing jq in an existing workflow.

Good to know, and what to watch

  • Reads and writes YAML.
  • Supports arbitrary-precision integer calculations.
  • Can be embedded as a Go library.
  • Offers several documented installation routes.
  • Free under the MIT License.
  • Object key order is not preserved.
  • Some jq number extensions and regular-expression syntax are unsupported.
  • Environment and module access need configuration in library use.
  • Library queries can run indefinitely or without output.

Free

Free

Open source

Getting started

  1. Open the gojq GitHub website
  2. Install with Homebrew, mise, Zero Install, a source build, or Docker
  3. Run jq-style queries against JSON input
  4. Use YAML input or output when needed
  5. Embed the library in a Go application and configure loaders if required

Limits to check

The CLI lacks key-order preservation and several jq extensions. Library callers must account for query execution that can produce infinite results or no output, and configure environment or module loaders for those capabilities.

The verdict

gojq provides JSON querying, YAML support, and an embeddable Go library, with some differences from jq. Review its compatibility limits and use RunWithContext when controlling library query duration matters.

Questions people ask

Is gojq free?

Yes. The Free plan costs nothing and is released under the MIT License.

Which platforms are available?

gojq supports Linux, macOS, Windows, and self-hosted use.

Can it process YAML?

Yes. gojq accepts YAML input and can produce YAML output.

Can Go programs embed it?

Yes. Go applications can parse and run queries, compile them for reuse, and configure custom functions and iterators.

How does it differ from jq?

gojq does not preserve object key order, does not parse jq's NaN, Infinity, or leading-zero number extensions, and has some differing regular-expression syntax.

What the maker publishes

Compatibility limits
gojq does not parse jq's NaN, Infinity, or leading-zero number extensions, and some regular-expression syntax differs from jq. source
Compatibility limits
gojq does not preserve object key order and lacks jq's keys_unsorted function and --sort-keys option. source
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. source
Execution limits
Library queries may emit infinitely many values or run without producing output, and the README recommends RunWithContext to limit execution time. source
Install options
The README documents installation through Homebrew, mise, Zero Install, building from source, and Docker images. source
Install options
The project documents installation through Homebrew, mise, Zero Install, go install, and Docker. source
JSON queries
The command applies jq queries to JSON input, including filtering, field selection, and updates. source
Library integration
Go applications can parse and run queries with gojq, compile queries for reuse, and configure custom functions and iterators. source
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. source
Library security
For library use, OS environment variables are inaccessible to queries by default; a caller can configure an environment loader. source
License
The software is released under the MIT License. source
License
The project is released under the MIT License. source
Limits
gojq does not preserve object key order and therefore does not provide the keys_unsorted function or the --sort-keys option. source
Module loading
The library's module feature is disabled by default and can be configured with a module loader. source
Number precision
gojq supports arbitrary-precision integer calculations for addition, subtraction, multiplication, modulo, and divisible division. source
Numbers
gojq supports arbitrary-precision integer calculations, while mathematical functions such as floor and round convert integers to floating-point numbers. source
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. source
Portability
The project describes gojq as completely portable because it is implemented in Go. source
Portability
The README describes gojq as implemented purely in Go and completely portable. source
Purpose
gojq is a pure Go implementation of the jq command and can also be embedded as a library in Go products. source
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. source
Queries
The CLI runs jq-style queries against JSON input and supports multiple input values. source
Support
The project directs users to report bugs through its GitHub Issues tracker. source
Support
The project directs users to report bugs through its GitHub Issues page. source

Checked against the maker's pages on 11 Oct 2026.