If I've got a structure like this: type jsonData struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` }
I can marshal / unmarshal JSON as: { "first_name": "first", "last_name": "last" } What if my input JSON is this: { "first_name": "first", "last_name": "last", "favorite_color": "orange", "age": 92 } Is there an existing library to have a structure that's something like this: type jsonData struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` Extras map[string]interface{} `json:",extras"` } Such that a JSON unmarshal and marshal will preserve the data of the original JSON? I think I can probably make something work with the standard library, except that it will require extra marshaling / unmarshaling steps that will be annoying to reproduce for each structure that needs to capture extra data. So I'm hoping there's a better solution? Eric -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/630827e2-8277-4231-9ab1-31881198a386%40googlegroups.com.