easyjson icon indicating copy to clipboard operation
easyjson copied to clipboard

Usage with go maps

Open estutzenberger opened this issue 7 years ago • 1 comments

Is it possible to use this library on a map with strings as keys? The map contains objects that I want to be marshaled by easyjson, but I also would like to keep the keys in my output JSON.

I've searched around for an example, but I did not easily find something.

Thanks!

estutzenberger avatar Feb 13 '18 22:02 estutzenberger

You can use easyjson generator if you declare new separate type for you map:

type MyMap map[string]MyStruct

and mark it with easyjson generator tag

rvasily avatar Jul 23 '18 22:07 rvasily