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: Cannot expand this json into a struct #17521

Closed
nemosupremo opened this issue Oct 20, 2016 · 2 comments
Closed

encoding/json: Cannot expand this json into a struct #17521

nemosupremo opened this issue Oct 20, 2016 · 2 comments

Comments

@nemosupremo
Copy link

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

play/go version go1.6.2 darwin/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/nimi/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.6.2/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.6.2/libexec/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT="1"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"

What did you do?

https://play.golang.org/p/pUe-e0u6cf

What did you expect to see?

sLabel.Value should be filled with a value.

What did you see instead?

Its empty

@odeke-em
Copy link
Member

Hello there @nemothekid, the issue there is that your sLabel field is an unexported value, making it SLabel instead of sLabel, makes in unmarshal-able. Please see https://play.golang.org/p/pmsIs2GW0O,

The Unmarshal docs talk about it that Unmarshal will only set exported fields.
screen shot 2016-10-19 at 10 56 05 pm

Also we use the issue tracker for tracking bugs, you can post questions on the mailing list https://groups.google.com/forum/#!forum/golang-nuts.

@mikioh mikioh changed the title json: Cannot expand this json into a struct encoding/json: Cannot expand this json into a struct Oct 20, 2016
@nemosupremo
Copy link
Author

Ah, sorry - such an obvious mistake in hindsight. I've been staring at that piece of code for far too long.

@golang golang locked and limited conversation to collaborators Oct 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants