Yeah, iirc JSON doesn't really have a clear distinction between float and 
int because it has to sort of stay parallel to javascript.

Found this link that explains a bit more...
Excerpt: 
```The precise treatment of the “integer” type may depend on the 
implementation of your JSON Schema validator. JavaScript (and thus also 
JSON) does not have distinct types for integers and floating-point values. 
Therefore, JSON Schema can not use type alone to distinguish between 
integers and non-integers. ```
from 
https://json-schema.org/understanding-json-schema/reference/numeric.html#id4

On Monday, November 2, 2020 at 3:36:07 AM UTC-8 Jan Mercl wrote:

> On Mon, Nov 2, 2020 at 12:30 PM irvan hendrik <irvan....@gmail.com> wrote:
>
> > yes. because when I marshal it to json the number got messed up.
> > when I entered value 10.0 it became 10.
> > If I use json.number it keeps the format 10.0.
>
> Sounds like conflating data and their representation. I'm not a json
> expert, but AFAIK, the sequence of characters `10` and `10.0`
> represent the very same json number.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/b6e7cb0e-849f-4d0f-8298-6d27d8752825n%40googlegroups.com.

Reply via email to