I'm trying to send a JSON object from a VBA application in Excel. The code below sends the request correctly, however I can't figure out how to make the request with the JSON object in the body.
Sub Post()
Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
URL = "http://localhost:3000/test"
objHTTP.Open "POST", URL, False
objHTTP.setRequestHeader "Content-type", "application/x-www-form- urlencoded"
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
objHTTP.send ("test=6")
End Sub
If I try for instance to send "{test:6, test2: 7}" and log the body of the request on the server I get { '{parts:6, test: 7}': '' }