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: output not always valid input #8962

gopherbot opened this issue Oct 19, 2014 · 3 comments

encoding/json: output not always valid input #8962

gopherbot opened this issue Oct 19, 2014 · 3 comments


Copy link

@gopherbot gopherbot commented Oct 19, 2014


What does 'go version' print?

go version go1.3.3 linux/amd64

What steps reproduce the problem?

1. Define type with underlying type []byte
2. Marshal a value of said type
3. Try to Unmarshal the result from Marshal

What happened?

Received an error "json: cannot unmarshal string into Go value of type

What should have happened instead?

Marshal should either refuse to encode the type, or Unmarshal should unmarshal the
result correctly.

The error happens because the encoding process compares against the slice element type,
while the decoding process compares against the slice type.
Copy link

@ianlancetaylor ianlancetaylor commented Oct 19, 2014

Comment 1:

Labels changed: added repo-main, release-go1.5.

@gopherbot gopherbot added new labels Oct 19, 2014
@bradfitz bradfitz modified the milestone: Go1.5 Dec 16, 2014
@rsc rsc removed the repo-main label Apr 14, 2015
Copy link

@osocurioso osocurioso commented Apr 26, 2015

Copy link

@gopherbot gopherbot commented Apr 26, 2015

CL mentions this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.