What is HTTP?
Hypertext Transfer Protocol is a data transfer protocol between two computers that are used to transfer data between an HTTP client (browser or mobile application) and a server. HTTP is built around messages called "request" and "response". Devices communicate with each other by sending HTTP requests and receiving HTTP responses. All modern programming languages natively support HTTP.
What it JSON?
JavaScript Object Notation (JSON) is a lightweight text-based, language-independent data exchange format. JSON defines a small set of formatting rules for the portable representation of structured data. JSON can represent four primitive types (strings, numbers, boolean values, and null) and two structured types (objects and arrays). JSON is used to exchange data between applications written in many programming languages, including JavaScript, Java, C ++, C #, Go, PHP, Python, and many others.
How to send data in JSON format?
You can send JSON data to the server in the body of an HTTP request and return JSON data from the server in the body of an HTTP response message. In both cases, you must explicitly specify the type of data in the body of the HTTP message using the Content-Type: application/json header (the application/json is the official MIME Type for JSON). The correct Content-Type header allows the server to interpret the data in the client's request correctly and will enable clients to correctly interpret the data in the server's response. Providing the Content-Length header is optional. If you don't know the size of JSON data, you may use chunked transfer encoding for your response.
JSON Response Example
The following is an example of JSON response when fetching data from ReqBin echo URL: