I am trying to unmarshal a json with a nested json.
I am using this struct
type atomRequest struct {
Stream string `json:"stream"`
Data map[string]interface{} `json:"data"`
}
if the nested json is stringified, the Unmasrhaling fails and the value is nil
if the byte array that i am marshalling is with a non escape "data" The "Data" map is being populated correctly.
if the nested json is stringified, I get an empty Data map.
I am looking for a solution to unmarshal the nested data, whether its stringified or not.
The example: this input works:
{"stream":"foobar","data":{"errorID":112,"timestamp":1524737466}}
This input does not work:
{
"stream": "foo",
"data": "{\"cd3\":\"514\",\"cd8\":\"none\"}"
}
can you help?
thanks