Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/json: decoder won't unmarshal scientific notation into integer #6657

gopherbot opened this issue Oct 24, 2013 · 3 comments


Copy link


What steps will reproduce the problem?
If possible, include a link to a program on

JSON decoding from scientific notation into an integer is not allowed by the JSON

Here is an example:

What is the expected output?

When decoding the JSON value 1e+06 into an int64, I'd expect decoding to succeed.

What do you see instead?
JSON Unmarshal() returns an error: "json: cannot unmarshal number 1e+06 into Go
value of type int64"

Which compiler are you using (5g, 6g, 8g, gccgo)?

6g (I think), this is amd64, not gccgo, using vanilla binaries from the tarball from

Which operating system are you using?

Ubuntu 13.04

Which version are you using?  (run 'go version')


Please provide any additional information below.
Copy link

robpike commented Oct 24, 2013

Comment 1:

It's not rigorously defined but I feel this should work. If the value fits, it should go
into the box.
I admit it's debatable.

Labels changed: added priority-later, removed priority-triage.

Status changed to Accepted.

Copy link

rsc commented Oct 29, 2013

Comment 2:

We decided against this a while back. I'll find the bug.

Copy link

rsc commented Oct 29, 2013

Comment 3:

Status changed to Duplicate.

Merged into issue #5562.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

3 participants