A high-performance Go library for setting values in JSON documents using dot-notation paths.
SJSON is a Go package for fast and straightforward modification of JSON data. It allows developers to set, update, append, or delete values within JSON strings using a simple dot-notation path syntax, making it ideal for applications requiring efficient JSON manipulation without full unmarshaling.
Go developers working with JSON data who need to perform targeted modifications, such as updating configuration files, processing API responses, or handling dynamic JSON structures in performance-sensitive applications.
Developers choose SJSON for its high performance, often outperforming standard Go JSON libraries and alternatives like ffjson or EasyJSON in benchmarks, and its simplicity with dot-notation paths that avoid the overhead of full unmarshaling and remarshaling.
Set JSON values very quickly in Go
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmarks show SJSON significantly outperforms encoding/json and alternatives like EasyJSON, with ReplaceInPlace mode achieving zero allocations and minimal latency.
Uses simple dot-notation paths like 'name.last' or 'children.1' for easy targeting of nested values, reducing code complexity compared to full unmarshaling.
ReplaceInPlace mode modifies JSON without extra memory allocations, ideal for performance-critical or memory-constrained environments as highlighted in benchmarks.
Part of a suite with GJSON for retrieval and JJ for CLI use, offering a complete JSON processing workflow without switching libraries.
The README admits invalid JSON doesn't panic but returns unexpected results, making it risky for applications with unreliable or unvalidated data sources.
Only supports basic set and delete operations; complex modifications like merging objects or conditional updates require additional logic or full unmarshaling.
Dot and colon characters must be escaped with backslashes in paths, which can lead to errors and reduced readability when dealing with special keys.