mholt/json-to-go

not support uint64

zzyheart opened this issue · 2 comments

uint64 value as 17307661572205707265 will be convert to int64, which case unmarshal error

Contributor here. JavaScript uses IEEE 754 floating point number system and only supports 53-bit numbers. Adding support for that can be quite involved and may need non-trivial preprocessing of the original JSON before parsing. uint64 would be a nice thing to have but it may not worth pursuing.

As a workaround, you can inspect the JSON and change the data type in the output Go code, based on the range of values you would expect a particular field to have.

Contributor here. JavaScript uses IEEE 754 floating point number system and only supports 53-bit numbers. Adding support for that can be quite involved and may need non-trivial preprocessing of the original JSON before parsing. uint64 would be a nice thing to have but it may not worth pursuing.

As a workaround, you can inspect the JSON and change the data type in the output Go code, based on the range of values you would expect a particular field to have.

Thanks!