3 ms·
My problem with serialization in Go isn't so much speed but marshalling/unmarshalling pain. I've been using these packages with some success: https://github.c
by OzzyB 7y ago
My problem with serialization in Go isn't so much speed but marshalling/unmarshalling pain.
I've been using these packages with some success:
https://github.com/tidwall/sjson https://github.com/tidwall/sjson
https://github.com/tidwall/gjson https://github.com/tidwall/gjson
Not knocking this pkg, just thought I'd share xD
- wvh 7y agoThere are surprisingly many ways to do JSON in Go. There's reflection with the stdlib as well as keeping parts of it as "raw" byte slices; code generation with packages like ffjson and easyjson; practically hand-built with gojay; the approach of a state machine on a simple byte string like gjson and jsonparser; and then through templates like e.g. quicktemplate. The best approach really depends on what you want to do. I think these sorts of challenges show that Go tends to be used in lower-level code than typical dynamic languages. I've combined three or four different approaches in several Go projects, which I couldn't imagine doing in a language like Python.