My go application needs to make a post request and a map will be put in the request body.
For now I'm firstly making the map to json string, and converting it to io.Reader.
I'm wondering if there is any way that I can skip json.Marshal
step?
var data map[string]interface{} {
"a": 1,
"b": "cdef",
...
}
jsonData, err := json.Marshal(data)
resp, err := http.Post(
"localhost:3000", "application/json", bytes.NewReader(jsonData))