I'm trying to create a JSON representation within Go using a map[string]interface{} type. I'm dealing with JSON strings and I'm having a hard time figuring out how to avoid the JSON unmarshaler to automatically deal with numbers as float64s. As a result the following error occurs.
Ex.
"{ 'a' : 9223372036854775807}" should be map[string]interface{} = [a 9223372036854775807 but in reality it is map[string]interface{} = [a 9.2233720368547758088E18]
I searched how structs can be used to avoid this by using json.Number but I'd really prefer using the map type designated above.
map[string]intor astruct{ a int }). That, or accept that it'll be a float and simply type-convert it to an int.encoding/jsondefaults to use float64s for json numbers. Type conversion would be the easiest solution if it worked with large int64 values. I guess I would have to write a custom marshaler or specify the map type. Thanks