<p>I have a JSON that I don't necessarily know the structure, when unmarshaling it to <code>map[string]interface{}</code>, all numbers have <code>float64</code> type.</p> <p>Creating the perfect struct to map the values is difficult since I don't have control over the JSON and this API may change without notice.</p> <p>Many of my values are actually <code>int64</code>, but since they became <code>float64</code> when I print on <code>html/template</code>, they look like this: 3.486912512e+09</p> <p>What's the best way to represent that number as 3486912512?</p> <hr/>**评论:**<br/><br/>GopherFromHell: <pre><p>you can use a json.Decoder and call the function Decoder.UseNumber() that will unmarshal to a json.Number instead of float64</p> <p><a href="https://golang.org/pkg/encoding/json/#NewDecoder" rel="nofollow">https://golang.org/pkg/encoding/json/#NewDecoder</a> <a href="https://golang.org/pkg/encoding/json/#Decoder.UseNumber" rel="nofollow">https://golang.org/pkg/encoding/json/#Decoder.UseNumber</a> <a href="https://golang.org/pkg/encoding/json/#Number" rel="nofollow">https://golang.org/pkg/encoding/json/#Number</a></p></pre>pinpinbo: <pre><p>Ah, that's it. Thanks!</p></pre>