Generates static MarshalJSON/UnmarshalJSON functions for Go structs, providing 2-3x faster JSON serialization with drop-in replacement.
ffjson is a Go tool that generates static MarshalJSON and UnmarshalJSON functions for struct types, providing 2–3 times faster JSON serialization and deserialization compared to the standard library's reflection-based approach. It solves performance bottlenecks in JSON-heavy applications by creating optimized code at build time while remaining a drop-in replacement for encoding/json.
Go developers working on high-performance applications where JSON serialization is a bottleneck, such as web servers, APIs, or data processing pipelines.
Developers choose ffjson because it delivers significant speed improvements without requiring code changes, seamlessly integrates with existing projects, and offers fine-grained control over serialization behavior through code generation.
faster JSON serialization for 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.
Delivers 2-3 times faster JSON serialization and deserialization by generating static code, as confirmed in the performance status section.
Acts as a drop-in replacement for encoding/json by implementing the same interfaces, requiring no code changes for existing projects.
Includes buffer pooling utilities and direct Marshal/Unmarshal calls to reduce garbage collection pressure in high-throughput scenarios.
Allows skipping structs or disabling encoder/decoder generation via code comments like 'ffjson: skip', offering fine-grained customization.
Requires re-running ffjson after every struct change, adding a manual build step that can be forgotten or disrupt development workflows.
For types like interfaces, complex maps, or inline structs in decoders, it falls back to slower reflection-based encoding, potentially negating speed gains.
Introduces an external code generation dependency that complicates CI/CD pipelines and requires version synchronization across teams.