I need to provide a map[string]interface{}
to a function. The JSON that is behind is this one :
{
"update": {
"comment": [
{
"add": {
"body": "this is a body"
}
}
]
}
}
I am completely stuck. I tried with nested structs, with maps, with a mix of both, I just cannot see the solution of this simple thing..
My last attempt is :
// Prepare the data
var data = make(map[string]interface{})
var comments []map[string]map[string]string
var comment = make(map[string]map[string]string)
comment["add"] = map[string]string{
"body": "Test",
}
comments = append(comments, comment)
data["update"]["comment"] = comments