A high-performance JSON parser and validator for Go that requires no custom structs, code generation, or reflection.
fastjson is a high-performance JSON parser and validator for Go, designed for scenarios where speed and low memory overhead are critical, such as real-time bidding (RTB) and JSON-RPC services. It parses arbitrary JSON without requiring predefined structs, code generation, or reflection, offering a flexible and simple API. The library focuses on raw parsing speed and single-pass parsing, outperforming alternatives when accessing multiple unrelated fields.
Go developers working on performance-sensitive applications like real-time bidding systems, JSON-RPC services, or any high-throughput JSON processing where schema is unknown or dynamic. It is also suitable for developers needing to parse heterogeneous JSON arrays or validate JSON efficiently.
Developers choose fastjson over alternatives because it provides up to 15x faster parsing than Go's standard encoding/json, operates without schema or reflection, and validates parsed JSON—unlike some other fast parsers. Its single-pass parsing excels when accessing multiple fields, and it maintains order preservation and supports data manipulation.
Fast JSON parser and validator for Go. No custom structs, no code generation, no reflection
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 up to 15x faster parsing than Go's standard encoding/json, with detailed metrics for various data sizes, ideal for high-throughput scenarios like RTB.
Parses arbitrary JSON without requiring struct definitions, reflection, or code generation, making it perfect for dynamic or unknown schemas, as highlighted in the features.
Uses single-pass parsing to outperform alternatives like jsonparser and gjson when accessing multiple unrelated fields, reducing overhead by parsing input only once.
Validates JSON during parsing, a feature absent in other fast parsers, ensuring data integrity without additional steps, as noted in the comparison with jsonparser and gjson.
Requires careful handling of object references; failing to release references before reuse can lead to program instability, a known limitation admitted in the README.
Cannot parse JSON directly from io.Reader, limiting use in streaming applications, with only a Scanner available for string-based streams, as stated in the limitations.
Marshaling capabilities are basic, and the README recommends using quicktemplate for high-performance JSON serialization, indicating it's not a focus area.