I'm trying to post a simple JSON to a remote server. The command line curl test works, but I can't seem to properly format my JSON string in the data variable for an http_post or http_send call. Any idea where my mistake is? I've tried both single quote and escaped double quotes.

Thanks!

Code
	string data = "{\
		\"apikey\":\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\", \
		\"systemid\":\"129392723\", \
		\"signal\":{ \
			\"action\":\"BTO\", \
			\"quant\": 3, \
			\"symbol\":\"AAPL\", \
			\"typeofsymbol\":\"stock\", \
			\"market\": 1, \
			\"duration\":\"DAY\" \
		} \
	}";

	int id = http_post(URL, data);



*************** server response *********************

{
   "ok" : "0",
   "error" : {
      "title" : "Invalid JSON",
      "message" : "\"':' expected, at character offset 1 (before \\\"\\\\\\\\r\\\\n\\\\t\\\\t\\\"apikey\\\":\\\"6...\\\")\\n\""
   }
}


Last edited by SBGuy; 06/08/20 16:33.