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

Cannot decode into embedded struct #50

Closed
orian opened this issue Aug 26, 2016 · 3 comments
Closed

Cannot decode into embedded struct #50

orian opened this issue Aug 26, 2016 · 3 comments

Comments

@orian
Copy link

orian commented Aug 26, 2016

The standard Json library could encode embedded:
https://play.golang.org/p/rA7yHzBYRk

In a case of Facebook' event when one gets it from user it may contain extra fields (rsvp_status) so I've tried to embed one into the other:

type FbEvent struct {
  ID string
  Name string
}

type FbUserEvent struct {
  *FbEvent
  RsvpStatus string
}

I've also tried with non-pointer FbEvent. In both cases the fields from FbEvent are empty.

@huandu
Copy link
Owner

huandu commented Aug 26, 2016

It sounds like a reasonable feature request. It's not supported right now. I can implement it soon.

@orian
Copy link
Author

orian commented Aug 26, 2016

I got it, was super easy. Will prepare a PR soon. Are you OK with it?

@huandu
Copy link
Owner

huandu commented Aug 26, 2016

I have a better solution. :)

Thanks for your PR anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants