How to post JSON data using Curl?

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 string. Double quotes in JSON must be escaped with the backslash "\" on Windows computers. In this Curl POST JSON example, we send JSON to the ReqBin echo URL. Click Run to execute the Curl POST JSON example online and see result.

Generate Code Snippets for How POST JSON Data Using Curl? Example

Convert your How POST JSON Data Using Curl? request to the PHP, JavaScript/AJAX, Node.js, Curl/Bash, Python, Java, C#/.NET code snippets using the ReqBin code generator.