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

Closed
gopherbot opened this issue Oct 24, 2013 · 3 comments
Closed

Comments

@gopherbot
Copy link

by dave@lytics.io:

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

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

Here is an example:
http://play.golang.org/p/yS3YNvt8BB


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
golang.org.

Which operating system are you using?

Ubuntu 13.04

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

1.1.2

Please provide any additional information below.
@robpike
Copy link
Contributor

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.

@rsc
Copy link
Contributor

rsc commented Oct 29, 2013

Comment 2:

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

@rsc
Copy link
Contributor

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.
Projects
None yet
Development

No branches or pull requests

3 participants