A Go library for parsing, querying, and manipulating JSON with JSONPath support and a built-in script engine.
Abstract JSON (ajson) is a Go library that parses, queries, and manipulates JSON data using JSONPath expressions. It solves the problem of working with JSON when its structure is uncertain, enabling dynamic traversal, filtering, and modification. The library includes a script engine for evaluating complex expressions and a CLI tool for command-line JSON processing.
Go developers who need to query, transform, or analyze JSON data dynamically, especially in scenarios where the JSON schema is variable or unknown. It is also useful for building data pipelines, log processors, or API response handlers.
Developers choose ajson for its comprehensive JSONPath implementation, thread-safe design, and extensible script engine, offering a powerful alternative to standard Go JSON libraries for dynamic JSON handling.
Abstract JSON for Golang with JSONPath support
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports the complete JSONPath syntax including filters, wildcards, recursive descent, and array slices, enabling complex queries like `$..[?(@.price < 10)]` on dynamic JSON.
Includes built-in functions such as avg(), sum(), and regex matching, plus extensible operators, allowing calculations and transformations directly within JSONPath expressions.
Stores calculated node values in atomic.Value, ensuring safe usage in multi-threaded Go applications without additional synchronization, as highlighted in the README.
Provides a CLI tool for evaluating JSONPath on files or streams from the terminal, useful for ad-hoc data processing without writing Go code, with examples using curl and Docker logs.
Benchmarks show higher memory allocations (7496 B/op vs 960 B/op for encoding/json) and slower operations, making it less ideal for latency-sensitive applications.
Dynamic querying without compile-time type checks increases likelihood of errors like missing keys or type mismatches, as the library does not enforce schemas.
As a specialized library, it has a smaller community and fewer third-party integrations compared to mainstream options like encoding/json, which could impact long-term support.