Upstream contribution to mailru/easyjson adding a noexponent struct tag for controlling float serialization format.
Problem
Financial applications need decimal notation (0.000001) instead of scientific notation (1e-6). The default Go JSON encoder uses scientific notation for small floats, which breaks downstream consumers expecting decimal format.
Solution
Added noexponent struct tag following the existing asString pattern:
type Price struct
Implementation
- 4 new Writer methods:
Float32NoExp,Float64NoExp,Float32StrNoExp,Float64StrNoExp - Tag parsing in gen/encoder.go
- Comprehensive test coverage
- ~80 lines of code
Status
- Issue #425: Feature request with analysis
- PR #432: Implementation submitted
- Fork: rhnvrm/easyjson
Inspired by noexponent tag pattern in google/go-querystring.