Quantcast
Channel: User Sergey Ponomarev - Stack Overflow
Viewing all articles
Browse latest Browse all 58

Answer by Sergey Ponomarev for Using EasyJSON with golang

$
0
0

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


Viewing all articles
Browse latest Browse all 58

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>