I am trying to send a post request to a API endpoint. The endpoint does not work without brackets in the JSON data.
map1: = map[string] map[string] interface {} {}
map2: = map[string] interface {} {}
map2["firstObject"] = "value1"
map2["secondObject"] = "value2"
map1["jsonName"] = map2
b, err: = json.Marshal(map1)
if err != nil {
panic(err)
}
fmt.Println(string(b)) // outputs: {"jsonName":{"firstObject":"value1","secondObject":"value2"}}
I need the output to be: {"jsonName":[{"firstObject":"value1","secondObject":"value2"}]}
However, I am getting this: {"jsonName":{"firstObject":"value1","secondObject":"value2"}}