XeroAPI / xerogolang

Golang SDK for the Xero API
MIT License
24 stars 28 forks source link

Million issue XML encoding #23

Open pieterb82 opened 5 years ago

pieterb82 commented 5 years ago

There's an issue in the library/Go with encoding floats. The default in Go is to marshal floats with more then 6 digits, so bigger then 1 million or 1000000, is encoded to scientific notation. Here's an example: https://play.golang.org/p/wgLouDNloYq

The solution would be to send over the data in JSON by default, as the encoding of JSON in the Go Library was fixed in the past, so there the floats that are bigger than a million aren't converted to scientific notation.

TheRegan commented 5 years ago

I've created a branch using only JSON to send data here. I've only been able to do limited testing but I believe there are some issues with this that need to be resolved. Your mileage may vary.

Please check it out and let me know if you encounter any issues and what they are:

https://github.com/XeroAPI/xerogolang/tree/jsononly