Simple testing for JSON-based applications

This project is maintained by jsontest

JSONTest.com is a testing platform for services utilizing JavaScript Object Notation (JSON). To use, make a request to servicename.jsontest.com, where servicename is the name of a service listed below. We also support a number of parameters, such as callback, allowing you to test Javascript and other web applications. For example, try this: http://ip.jsontest.com/?callback=showMyIP


  1. IP Address
  2. HTTP Headers
  3. Date & Time
  4. Echo JSON
  5. Validate
  6. Arbitrary JS Code
  7. Cookie
  8. MD5


  1. Callback
  2. Allow Origin
  3. MIME


IP Address

Calling http://ip.jsontest.com/ will return your IP address in JSON form. Example:

{"ip": ""}

Endpoint: http://ip.jsontest.com/


Returns the HTTP request headers received from the client.

   "Accept-Language": "en-US,en;q=0.8",
   "Host": "headers.jsontest.com",
   "Accept-Charset": "ISO-8859-1,utf-8;q=0.7,*;q=0.3",
   "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"

Endpoint: http://headers.jsontest.com/

Date & Time

Returns a JSON object with the current date and time in human-readable form, and the current number of milliseconds since UNIX epoch (this is equivalent to the Javascript call (new Date()).getTime() ).

Date and time are expressed using the GMT time zone.

   "time": "03:53:25 AM",
   "milliseconds_since_epoch": 1362196405309,
   "date": "03-02-2013"

Endpoint: http://date.jsontest.com (or http://time.jsontest.com )


Returns a customized JSON object that you can define through a REST-style URL. For example, calling http://echo.jsontest.com/key/value/one/two will return the following JSON:

   "one": "two",
   "key": "value"

Endpoint: http://echo.jsontest.com/insert-key-here/insert-value-here/key/value


Validates a given JSON object against the org.json reference parser. To use, tack a JSON string to a json parameter, as in: http://validate.jsontest.com/?json={"key":"value"}; this returns the following JSON:

   "object_or_array": "object",
   "empty": false,
   "parse_time_nanoseconds": 19608,
   "validate": true,
   "size": 1

If the JSON object was parsed successfully, the validate parameter will be set to true. The size parameter counts the number of top level keys inside the JSON object. Empty is true if the JSON object has no key:value pairs, false if there is at least 1 pair. Parse_time_nanoseconds counts how long the org.json parser took to parse the JSON text.

If invalid JSON is passed in, the validate parameter will be false, and an explanation of why parsing failed will be added. The explanation is taken directly from the org.json parser Exception message. As an example, suppose we tried to validate {"key":"value" (this JSON is incorrect because it misses the closing } brace). We can validate by going to http://validate.jsontest.com/?json={"key":"value" . Here's the result:

   "error": "Expected a ',' or '}' at 15 [character 16 line 1]",
   "object_or_array": "object",
   "error_info": "This error came from the org.json reference parser.",
   "validate": false

Note: GET requests are supported, though not recommended while using this service. You should use POST requests if possible.

Top-level JSON arrays can also be passed in; if so, the object_or_array parameter will be set to true, and the size parameter counts the number of elements within the array. For instance, parsing the array [1,2,3] will return the following JSON:

   "object_or_array": "array",
   "empty": false,
   "parse_time_nanoseconds": 127664,
   "validate": true,
   "size": 3

Endpoint: http://validate.jsontest.com/?json=[JSON-code-to-validate]

Arbitrary JS Code

JSONP is not just JSON; it is a JSON object wrapped inside a Javascript function call. However, JSONP is not just limited to function calls; you may embed any Javascript code needed.

This service sends back JS code to create two alerts(), one that shows your IP address, and one that shows the current time in milliseconds. An example is below:

alert("Your IP address is:");

Endpoint: http://code.jsontest.com


Sets a cookie with a name of jsontestdotcom, containing a value of the current time in milliseconds. The server will then return the following JSON:

{"cookie_status": "Cookie set with name jsontestdotcom"}

Endpoint: http://cookie.jsontest.com/


Returns the MD5 hash code of a given string. To use, call http://md5.jsontest.com/?text=example_text, where example_text is the text that you want the MD5 hash for. For example, the above request would return:

   "md5": "fa4c6baa0812e5b5c80ed8885e55a8a6",
   "original": "example_text"

Endpoint: http://md5.jsontest.com/?text=[text to MD5]

Optional Parameters

The parameters below work on all of the above services.


For JSONP applications to work, they need to be able to specify a callback parameter. You can specify a callback parameter by appending ?callback=[function_name], where [function_name] represents the Javascript function name to send the JSON object to.

For example, calling http://ip.jsontest.com/?callback=showIP will return this response:

showIP({"ip": ""});

Access-Control-Allow-Origin Header

Most web applications run in a sandbox, preventing them from accessing content from different web sites. Servers that host content and APIs available to external applications must specify which apps are allowed by setting the Access-Control-Allow-Origin header.

By default, JSONTest.com sets this header to *, meaning that any web application regardless of its origin url (such as localhost) can communicate with the server. You can turn this header off by adding the parameter ?alloworigin=false to any service listed above. It is NOT recommended that you use this functionality; this should only be used for testing your application's ability to gracefully degrade.

More information can be found at W3C Cross-Origin Resource Sharing and Mozilla: HTTP Access Control.


JSONTest.com follows IETF and IANA recommendations for the MIME type of JSON content: JSON content is set to "application/json" and JSONP content is declared as "application/javascript". See IANA Media Types, IETF RFC 4627 (JSON Specification), and IETF RFC 4329 (Scripting Media Types) for further documentation.

However, you may want to set other media types for your application. For any service listed above, you may change its media type by setting the parameter ?mime=[mime-int], where [mime-int] is a number from the list below:

  1. application/json
  2. application/javascript
  3. text/javascript
  4. text/html
  5. text/plain

For instance, calling http://ip.jsontest.com/?mime=5 would return your IP address within a JSON object with a MIME type of text/plain.


It is recommended that you use the servicename.jsontest.com URL syntax while accessing JSONTest.com services. However, if you wish to specify the service required using a parameter, you may do so. Simply append `?service=**[servicename]** to any JSONTest endpoint. For instance, calling http://date.jsontest.com/?service=ip will return your IP address.