I want to convert from string to object.
From
{"key1": "{
\"key2\": \"value2\",
\"key3\": {
\"key4\": \"value4\"
}
}
"}
To
{"key1": {"key2": "value2", "key3": {"key4": "value4"}}}
Finally, I want to get value4
.
I can get the value of "key1" using below script.
jsondata := `{"key1": "{
\"key2\": \"value2\",
\"key3\": {
\"key4\": \"value4\"
}
}
"}`
var m map[string]interface{}
json.Unmarshal([]byte(jsondata), &m)
value := m["key1"]
fmt.Println(value)
https://play.golang.org/p/4lwgQJfp5S
But I can't convert the value to an object. So I can't get "value4". Are there methods for this? I can get it by regex like https://play.golang.org/p/6TB-qNAdgQ But now this is not my solution.
Thank you so much for your time and advices. And I'm sorry for my immature question.