Java code for JSON Response ExampleThis Java code snippet was generated automatically for the JSON Response example.
<< Back to the JSON Response example
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?
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: