You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
just found out I need to explicitly NOT to put //easyjson:json for data structure, and do not use -all in easyjson generation, then it can fall back to default JSON, still wondering, can we just use easyjson or json to process with different lib?
easyjson generates (un)marshaling functions, so struct implements https://golang.org/pkg/encoding/json/#Unmarshaler interfaces, so we will have full drop-in replacement. You dont need to write easyjson.Unmarshal anywhere, generated code will be called from json.Unmarshal
Thanks, @rvasily , I am confused about "You dont need to write easyjson.Unmarshal"
in easyJSON doc,
"easyjson also generates MarshalJSON and UnmarshalJSON funcs for Go struct types compatible with the standard json.Marshaler and json.Unmarshaler interfaces. Please be aware that using the standard json.Marshal / json.Unmarshal for marshaling/unmarshaling will incur a significant performance penalty when compared to using easyjson.Marshal / easyjson.Unmarshal."
so if we do not change code from json.Unmarshaler to easyjson.Unmarshal, do we have same performance as default JSON? as I have benchmarked , json.Unmarshaler is much slower
so I think in our code, we still need to change json.Unmarshaler to easyjson.Unmarshal? or even json.Unmarshaler will have same performance as easyjson.Unmarshal?
Hi, It seems if I have used easyjson to generate some parsing file, and in code use
easyjson.Unmarshal(body, &mystruct)
it will parse uses easyjson. however, if I want to fall back into
json.Unmarshal(body, &mystruct)
it still uses easyjson parser, not standard json parser. since it will have same issue as easy JSON(case sensitive issue raised in #237)
is there sth wrong
The text was updated successfully, but these errors were encountered: