How do I POST JSON with Curl? [JavaScript/AJAX Code]

To post JSON data using Curl, you need to set the Content-Type of your request to application/json and pass the JSON data with the -d command line parameter. The JSON content type is set using the -H "Content-Type: application/json" command line parameter. JSON data is passed as a flat string. Double quotes in JSON must be escaped with the backslash \. Click Run to execute Curl POST JSON example online and see results. This will post JSON to the ReqBin echo URL. The JavaScript/AJAX code was automatically generated for the Curl POST JSON example.
Loading...