encoding/json: Invalid json is parsed ok #21227
Closed
Labels
Comments
IMO this is working as intended. Your example contains two fragments of json |
What @dcheney-atlassian said. The docs do say:
If you only want to read one element, use Unmarshal or use https://golang.org/pkg/encoding/json/#Decoder.Token to see if EOF is next. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.8.3
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/cassiobotaro/go" GORACE="" GOROOT="/usr/lib/go" GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build528676691=/tmp/go-build -gno-record-gcc-switches" CXX="g++" CGO_ENABLED="1" PKG_CONFIG="pkg-config" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2"
What did you do?
https://play.golang.org/p/r7FBkS2Cq7
What did you expect to see?
An error because json is not valid.
What did you see instead?
No errors.
The text was updated successfully, but these errors were encountered: