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

Comments

Projects
None yet
3 participants
@nemosupremo
Copy link

commented Oct 20, 2016

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

This comment has been minimized.

Copy link
Member

commented Oct 20, 2016

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.

@odeke-em odeke-em closed this Oct 20, 2016

@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

This comment has been minimized.

Copy link
Author

commented Oct 20, 2016

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.
You can’t perform that action at this time.