JSON Marshal Library
By default, Hertz integrates with and uses Sonic for serializing
ctx.JSON interface and deserialization requests as defined in the
Sonic is an ultra-high performance golang json library, also see Sonic README for details.
The following are requirements to enable Sonic:
- Go 1.16 or above
- Linux / darwin OS / Windows
- Amd64 CPU with AVX instruction set
Sonic automatically fallback to golang’s
encoding/json library when the above requirements have not been satisfied.
Bringing Your Own JSON Marshal Library
Hertz supports conditional compilation to control the actual json library used, you can use
-tags stdjson to choose to use the standard library.
go build -tags stdjson
Sonic related issues
Was this page helpful?