Skip to content

Consuming unknown JSON input #125

@tmcarr

Description

@tmcarr

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions