Curl/Bash code for JSON Content Type ExampleThis Curl/Bash code snippet was generated automatically for the JSON Content Type example.
<< Back to the JSON Content Type example
Why is it important to specify the correct content type for JSON?Every resource transmitted over HTTP has a media type, also known as a MIME type, which is used to describe the resource type in the body of an HTTP message and allows browsers and servers to interpret them correctly. For example, if the server can accept JSON and XML content types on the same endpoint, then setting Content-Type to application/json will tell the server to interpret the data in the body as JSON, and setting Content-Type to application/xml will tell the server to interpret the data as XML.
Example of sending JSON with correct Content-Type headerExample of posting JSON data to the ReqBin echo URL.
Example of getting JSON with correct Content-Type headerAn example of loading JSON data from the ReqBin echo URL.
See also JSON Request Example, JSON Response Example.