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

Consuming unknown JSON input #125

Closed
tmcarr opened this issue Jun 12, 2017 · 3 comments
Closed

Consuming unknown JSON input #125

tmcarr opened this issue Jun 12, 2017 · 3 comments

Comments

@tmcarr
Copy link

tmcarr commented Jun 12, 2017

It would be nice to go over how one can consume json with some number of unknown fields.

I have a case where I need to consume a file with a certain set of known fields that I can make structs for, but some of those fields can contain any number of user entered fields and values and I'm unsure of how to handle this. I've seen some info in the godocs about setting the type to interface{} and then using a switch case to detect the type of the fields inside, but its pretty unclear.

Thanks!
Travis

@tmcarr
Copy link
Author

tmcarr commented Jun 12, 2017

Also, I cant seem to add the label you request in the README.

@arschles
Copy link
Owner

Hi @tmcarr - sorry for the delay, I'm starting up GIFM again after a long time off, and I like this idea. I have a few ideas on casts for this, so I'll present at least one of them as soon as I can, and I'll update here.

Also, I added the label for you. I'm gonna need to update the README to not require folks to add the label - GH doesn't allow it 😄

@arschles
Copy link
Owner

@tmcarr check out episode 19 - this is done

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