Testing JSON Response Online [PHP Code]

ReqBin is the best online JSON request/response testing tool. Test a REST API request online to an API endpoint and test the JSON response. Inspect JSON response with automatic syntax highlighting and JSON validator. Click Send to execute the Test JSON request online and see and analyze the JSON response from the server. The PHP code was automatically generated for the Test JSON Response Online example.
Testing JSON Response Online [PHP Code] Send
GET /echo/get/json HTTP/1.1
Host: reqbin.com

Updated: Viewed: 26961 times
PHP code for Test JSON Response Online example

PHP code for Test JSON Response Online Example

This PHP code snippet was generated automatically for the Test JSON Response Online example.
<< Back to the Test JSON Response Online example

What is JSON?

JSON (JavaScript Object Notation) is a language-independent text format for storing and exchanging data. A web application uses JSON to exchange data between a web browser and a server and to exchange data between servers using REST API. For many programming languages, including Java, JavaScript, C ++, C #, Go, PHP, and Python, there are ready-made code libraries for creating and manipulating JSON data. JSON file names use the .json file extension.

JSON Example
{
  "Id": 78912,
  "Customer": "Jason Sweet",
  "Quantity": 1,
  "Price": 18.00
}

What is REST API?

REST (Representative State Transfer) is a way to connect two computer systems over the Internet. The REST API is browser and programming language-independent. Any modern browser can be used to run your REST API client, and any programming language can be used to create desktop or mobile REST API applications.

The REST API define a set of rules for developers:

  • Client-server: a REST API client (website, desktop or mobile application) should separate from the REST API server (request processor and data storage) so that each part can be developed and scaled independently.
  • Stateless: REST API requests must be executed with all the necessary data without assuming the server may have previous REST API client data.
  • Layered: the REST API client does not need to know if it communicates with an actual server or an intermediary. Additional scalability and security can be provided by intermediate servers (proxies or load balancers).
  • Cacheable: Every REST API response must be cacheable.

How to test a JSON response?

To test a JSON response using the ReqBin JSON API test tool, first, send a JSON request:

JSON Request Example
GET /echo/get/json HTTP/1.1
Host: reqbin.com

You will receive a JSON Response from the server:

Response JSON Request Example
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 19
Connection: keep-alive

{"success":"true"}

See also

Generate code snippets for PHP and other programming languages

Convert your Test JSON Response Online request to the PHP, JavaScript/AJAX, Node.js, Curl/Bash, Python, Java, C#/.NET code snippets using the PHP code generator.