// the find
francoispqt/gojay
high performance JSON encoder/decoder with stream API for Golang
GoJay is a zero-reflection JSON encoder/decoder for Go that trades the convenience of `encoding/json` for speed. You implement small interfaces on your types and the library handles the rest without any reflection at parse time. It's for services where JSON serialization is actually a measured bottleneck — not something to reach for by default.
The interface-based design (UnmarshalerJSONObject, MarshalerJSONObject) is genuinely clean — you write a switch statement on keys, and the compiler can optimize it. Benchmark numbers are real and reproducible, not cherry-picked against artificially slow configs. The stream decoder is the standout feature: JIT decoding from io.Reader directly to a channel with context cancellation is something most JSON libraries don't bother with, and it's well thought out. The encoder/decoder pool is exposed explicitly via BorrowDecoder/BorrowEncoder, which is more honest than hiding pooling behind the API and letting you cause subtle bugs.
Last commit was November 2023 and the project is effectively unmaintained — issues and PRs sit open with no response. The mandatory interface implementation on every type is a lot of boilerplate for modest payloads; the code generation tool exists but is a separate binary that adds toolchain friction. The Unsafe API warning is real: buffer reuse causing data corruption is a sharp edge, and the docs bury it. By 2024 standards, sonic and fastjson have caught up or passed gojay on most benchmarks while requiring less ceremony, so the performance argument is weaker than it was in 2018 when this was written.