A pure Go implementation of jq for parsing, filtering, and transforming JSON and YAML data.
gojq is a pure Go implementation of the jq command-line JSON processor. It parses, filters, and transforms JSON and YAML data using the jq query language, offering a portable alternative with additional features like arbitrary-precision integer arithmetic and YAML support. It solves the need for a dependency-free, embeddable tool for manipulating structured data in scripts and Go applications.
Developers and DevOps engineers who work with JSON/YAML data in shell scripts, and Go developers needing an embeddable library for programmatic data querying and transformation.
Developers choose gojq for its portability (no C dependencies), ability to embed as a Go library, support for arbitrary-precision integers, and YAML I/O—features that address limitations in the original jq while maintaining query compatibility.
Pure Go implementation of jq
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Has no external C dependencies, simplifying builds and distribution across platforms, as highlighted in the README for avoiding complex library setups.
Maintains precision for large integer calculations, unlike jq, demonstrated with factorial examples in the README to prevent data loss.
Supports reading from and writing to YAML format via --yaml-input and --yaml-output flags, a feature not available in the original jq for configuration processing.
Can be integrated as a Go library with a clean API, allowing programmatic JSON/YAML querying, as shown in the README with examples for parsing and running queries.
Provides clear, contextual error messages for invalid queries or JSON input, enhancing debugging with specific token and position details in outputs.
Does not keep the order of object keys due to Go's map implementation, breaking scripts that rely on key order and missing functions like keys_unsorted.
Restricts advanced regex features like backreferences and look-around assertions because of Go's regex engine, hindering complex text processing tasks.
Intentionally omits several jq functions and flags, such as get_jq_origin, --ascii-output, and JSON extensions, reducing compatibility for specialized use cases.
Requires input data to be in specific types (map[string]any or []any) when used as a library, adding marshaling/unmarshaling steps for custom structs.
gojq is an open-source alternative to the following products: