I have an POST API that accepts a json file and a string value as multipart/form-data content-type body.
How do I convert a struct in Golang as json file to send as POST http request?
Example of the struct:
data := map[string]interface{}{
"type": "doc",
"name": "test_doc",
"ids": []string{
"user1",
"user2",
},
"isFlagged": true,
}
I would need this to be json file as part of the request body for form-data content-type without actually storing the file locally.