> So my question is: Prior to go 1.8's release, how can we force float64 > values to be output in decimal? This is a problem for me specifically > because our mobile user's report their lat/lon with six places of precision. > Trying to dump that output to JSON causes a bunch of unusable scientific > notation in the output.
What makes it unusable? Even if it's inconvenient for some reason, it's still correct. It should be interoperable with other systems. > I know that you can implement a MarshalJSON method, but that only really > allows me to customize what happens before json.Marshal is called. No > matter what I've tried, it still mangles the output. I'm not really sure what this means. You can always do whatever encoding you want in MarshalJSON as long as the result is valid JSON. Here's an example where I copied Russ's code to a custom float64 type: https://play.golang.org/p/gNO9hgf1k5 -Caleb -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.