Pure Go implementation of jq with additional features
gojq is a pure Go implementation of the popular jq command-line JSON processor. It provides all the functionality of jq for querying, filtering, and manipulating JSON data, but with the advantages of being written in Go - making it completely portable without dependencies on C libraries. The tool can be used both as a standalone command-line utility and as a library embedded in Go applications.
One of gojq's key advantages over the original jq is its support for arbitrary-precision integer calculations, maintaining precision with large numbers that would otherwise be lost in floating-point conversions. It also includes several behavioral improvements and bug fixes that address long-standing issues in jq, such as better string indexing, improved time formatting, and enhanced error handling. Additionally, gojq extends jq's capabilities by supporting YAML input and output formats.
The tool is ideal for developers who work with JSON data processing, API responses, configuration files, and data transformation tasks. It's particularly valuable for Go developers who want to embed JSON querying capabilities directly into their applications, and for users who need a portable, dependency-free alternative to jq with enhanced precision handling for numerical data.
# via Homebrew
brew install gojq
# via Go
go install github.com/itchyny/gojq/cmd/gojq@latest
# via Docker
docker run -i --rm itchyny/gojq