↧
Answer by kenjoe41 for Unmarshal JSON in JSON in Go
if i were to create a custom UnmarshalJson for that data, I would create an auxiliary struct auxMain that has the same fields as the main struct but with Bar field as string. Then it unmarshals the...
View ArticleAnswer by Jonathan Hall for Unmarshal JSON in JSON in Go
I guess you want to treat this as if the JSON String were just part of the surrounding JSON object? If so, then yes, as you suggest, a custom UnmarshalJSON method on Child should accomplish this.func...
View ArticleUnmarshal JSON in JSON in Go
I want to unmarshal a JSON object where one field contains a JSON string into one coherent object. How do I do that in Go?Example:Input:{"foo":1,"bar":"{\\"a\\":\\"Hello\\"}"}Go type:type Child struct...
View Article