easyjson
easyjson is a Go code generator that creates fast JSON marshaling/unmarshaling functions for structs without reflection, delivering 4–5× faster performance than Go's standard json package. It supports customization options like snake_case field naming and omitempty behavior while keeping generated code readable and maintainable.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | mailru/easyjson |
| Owner | mailru |
| Primary language | Go |
| License | MIT — OSI-approved |
| Stars | 4.9k |
| Forks | 462 |
| Open issues | 98 |
| Latest release | v0.9.2 (2026-03-14) |
| Last updated | 2026-03-14 |
| Source | https://github.com/mailru/easyjson |
What easyjson is
easyjson generates type-safe MarshalEasyJSON/UnmarshalEasyJSON methods via code generation, avoiding reflection overhead and enabling unsafe string optimizations. It provides both easyjson.Marshaler interfaces and standard json.Marshaler compatibility, with configurable options for field naming, string interning, and memory pooling via sync.Pool.
Get the easyjson source
Clone the repository and explore it locally.
git clone https://github.com/mailru/easyjson.gitcd easyjson# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Code generation must run as a build step (easyjson -all <file>.go); integrate into go:generate directives or CI/CD to regenerate when structs change.
- Requires a full Go build environment with GOPATH set; confirm compatibility with your build toolchain and containerization strategy.
- Generated code uses unsafe for zero-copy string conversions during unmarshaling; audit for your security model if untrusted JSON is a concern.
- String interning (intern tag) trades CPU for memory when few unique string values repeat frequently; profile to determine if it reduces allocations in your workload.
- Manual marshaler/unmarshaler implementations can override generated ones; design struct hierarchies to leverage code generation without excessive custom overrides.
When to avoid it — and what to weigh
- Dynamic JSON structures required — easyjson requires static Go struct definitions. If you need to handle arbitrary JSON shapes or frequent schema changes, the standard json package or third-party unmarshaling into map[string]interface{} is more suitable.
- Case-insensitive field matching needed — Object keys are case-sensitive by design; case-insensitive matching is explicitly not supported due to performance considerations. Use standard json if this is critical.
- Early-stage or frequently-changing projects — The README notes easyjson is 'still early in development' with potential bugs and missing features compared to encoding/json. If stability and feature parity matter more than performance, reconsider.
- Vendoring/dependency isolation constraints — easyjson code generation requires GOPATH and invokes go run on temporary files. Some restricted build environments (monorepos, offline builds) may conflict with this approach.
License & commercial use
MIT License. Permissive OSI-approved license allowing commercial use, modification, and distribution with minimal restrictions (retain license notice).
MIT license permits commercial use. However, verify compliance with any other dependencies you bundle. No warranty is provided; assess risk tolerance for closed-source projects relying on a code-generation tool.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Strong |
| Assessment confidence | High |
Uses unsafe for no-copy string conversion during unmarshaling. Review the impact in your threat model if untrusted JSON from external sources is processed. No explicit security audit data provided; treat as a build-time tool risk, not a runtime cryptographic vulnerability. Validate generated code in security-critical paths.
Alternatives to consider
encoding/json (standard library)
Built-in, no dependencies, full feature parity with JSON spec, case-insensitive matching. Trade-off: 4–5× slower due to reflection; acceptable for non-performance-critical services.
json-iterator/go
Drop-in replacement for encoding/json with better performance (2–3× faster than standard but slower than easyjson) and more features. Avoids code generation; simpler integration but less customization.
ffjson
Similar code-generation approach to easyjson (on which easyjson was inspired). Older and less actively maintained; easyjson is the modern alternative.
Build on easyjson with DEV.co software developers
Evaluate easyjson for your high-throughput API or microservice project. Our engineers can help assess compatibility, integrate code generation into your CI/CD, and profile real-world gains. Contact us for a technical review.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
easyjson FAQ
How much performance gain should I expect?
Can I customize the generated code?
Does it work with generic or nested structs?
Is it safe to use unsafe in production?
Work with a software development agency
From first prototype to production, DEV.co delivers software development services around tools like easyjson. Our software development agency staffs experienced software developers and web developers for custom software development, web development, integrations, and ongoing support across ai coding agents and beyond.
Ready to optimize your Go JSON performance?
Evaluate easyjson for your high-throughput API or microservice project. Our engineers can help assess compatibility, integrate code generation into your CI/CD, and profile real-world gains. Contact us for a technical review.