You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to unmarshal my json string into an orderedmap, this is my string: "{\n \"IDs\": [\n 7236290603911250220\n ] \n}"
But I got the result:
I check the source code, and find out that the func UnmarshalJSON of OrderedMap does not use json.Number when decoding string into values, which leads to the precision loss in this issue.
I think it's necessary to use json.Number like this: dec := json.NewDecoder(bytes.NewReader(b)) dec.UseNumber() err := dec.Decode(&o.values) if err != nil { return err }
The text was updated successfully, but these errors were encountered:
I tried to unmarshal my json string into an orderedmap, this is my string:
"{\n \"IDs\": [\n 7236290603911250220\n ] \n}"
But I got the result:
I check the source code, and find out that the func UnmarshalJSON of OrderedMap does not use json.Number when decoding string into values, which leads to the precision loss in this issue.
I think it's necessary to use json.Number like this:
dec := json.NewDecoder(bytes.NewReader(b)) dec.UseNumber() err := dec.Decode(&o.values) if err != nil { return err }
The text was updated successfully, but these errors were encountered: