We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
go version
1.18
Yes, reproducible with go 1.19
go env
GO111MODULE="on" GOARCH="arm64" GOBIN="" GOCACHE="/Users/steve/Library/Caches/go-build" GOENV="/Users/steve/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="arm64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/steve/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/steve/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64" GOVCS="" GOVERSION="go1.18" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/steve/yuzu/crypto-stream-source/go.mod" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/q_/381gr8255wl427x33rzsyvk80000gn/T/go-build2527350202=/tmp/go-build -gno-record-gcc-switches -fno-common"
Given this block of JSON (example taken from a Binance websocket payload):
{ "e": "24hrTicker", "E": 123456789 }
encoding/json will return an error while unmarshaling into this struct:
type UnsuccessfulUnmarshal struct { TimeStamp int64 `json:"E"` }
but not this struct:
type SuccessfulUnmarshal struct { Event string `json:"e"` TimeStamp int64 `json:"E"` }
No error returned when only some of the fields in the json payload are defined in the destination struct
This error returned:
json: cannot unmarshal string into Go struct field UnsuccessfulUnmarshal.E of type int64
The text was updated successfully, but these errors were encountered:
Duplicate of #14750
Sorry, something went wrong.
No branches or pull requests
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, reproducible with go 1.19
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Go Playground
Given this block of JSON (example taken from a Binance websocket payload):
encoding/json will return an error while unmarshaling into this struct:
but not this struct:
What did you expect to see?
No error returned when only some of the fields in the json payload are defined in the destination struct
What did you see instead?
This error returned:
The text was updated successfully, but these errors were encountered: