Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Unmarshal dynamic key in JSON
func (s ResultObject) UnmarshalJSON(data []byte) map[string]interface{} {
var z map[string]interface{}
if err := json.Unmarshal(data, &z); err != nil {
fmt.Println(string(data[:]))
panic(err)
}
return z
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment