A blazingly fast JSON serializing & deserializing library for Go, accelerated by JIT and SIMD.
Sonic is a JSON serializing and deserializing library for the Go programming language. It is engineered for maximum performance, utilizing JIT compilation and SIMD instructions to significantly outperform standard and other third-party JSON libraries. It solves the problem of JSON processing being a bottleneck in high-throughput Go applications.
Go developers building high-performance services, APIs, or data processing pipelines where JSON serialization/deserialization speed is critical.
Developers choose Sonic because it consistently delivers the fastest JSON processing speeds for Go, as demonstrated by extensive benchmarks. It provides a powerful AST for flexible JSON manipulation and offers both easy migration from `encoding/json` and advanced APIs for optimization.
A blazingly fast JSON serializing & deserializing library
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 Sonic outperforms stdlib, jsoniter, and go-json across all JSON sizes and scenarios, leveraging JIT and SIMD for speed.
Provides ast.Node APIs for searching, modifying, and serializing JSON without a fixed schema, enabling runtime binding and partial parsing.
Decodes from io.Reader and encodes to io.Writer, reducing memory consumption for handling large or multiple JSON values efficiently.
Offers pretty-printed syntax and mismatch type errors with detailed position information, easing debugging compared to standard libraries.
Default settings skip HTML escaping and sort keys to boost speed, breaking RFC8259 compliance and requiring explicit options for alignment with encoding/json.
Restricted to Go 1.18-1.26 and AMD64/ARM64 CPUs, with issues like Go1.24.0 unsupported without build flags, limiting portability.
Uses memory pools that can spike in-use memory under load, necessitating careful configuration with options like CopyString or buffer size controls.