To serialize:
rawBytes, err := easyjson.Marshal(yourObject)
But internally it will create a new byte array so if you can dump to writer then use easyjson.MarshalToWriter()
or even easyjson.MarshalToHTTPResponseWriter()
:
_, _, err = easyjson.MarshalToHTTPResponseWriter(yourObject, w)
To deserialize:
err = easyjson.Unmarshal(rawBytes, yourObject)
See their documentation https://pkg.go.dev/github.com/mailru/easyjson@v0.7.7#Marshal