Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
encoding/json: output not always valid input #8962
What does 'go version' print? go version go1.3.3 linux/amd64 What steps reproduce the problem? http://play.golang.org/p/MQmD9eJmYY 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 main.Bytes" 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.