Closed
Description
by hitesh.jasani:
Before filing a bug, please check whether it has been fixed since the latest release. Search the issue tracker and check that you're running the latest version of Go: Run "go version" and compare against http://golang.org/doc/devel/release.html If a newer version of Go exists, install it and retry what you did to reproduce the problem. Thanks. What steps will reproduce the problem? If possible, include a link to a program on play.golang.org. 1. Run http://play.golang.org/p/6UeIwpPMGU 2. 3. What is the expected output? An error message indicating which field caused the unmarshaller to choke. Something like "json: cannot unmarshal number into Go value of type string for key/name 'Zip'" What do you see instead? "json: cannot unmarshal number into Go value of type string" Which compiler are you using (5g, 6g, 8g, gccgo)? default compiler Which operating system are you using? OS X 10.9 (13A603) Which version are you using? (run 'go version') go version go1.2rc3 darwin/amd64 Please provide any additional information below. In the example I provided, it is trivial to deduce that either the programmer mistakenly defined the Zip code field to be string when it should have been an int or the input json received was invalid. In practice, json objects are much larger and more complex. Determining which field of the hundreds in the message caused the unmarshaller to choke is time consuming and painful. The task could be made much easier if the field name were displayed as part of the error message making it easier to track down bugs.