JSON Test

testing for JSON applications

View project onGitHub

JSON Test.com

JSON Test.com is a testing platform for programs utilizing JavaScript Object Notation (JSON). To use, just make a request to servicename.jsontest.com. For example, calling http://ip.jsontest.com will return your IP address in JSON-formatted form. JSON Test supports a bunch of services, which are listed below (more coming soon).

We also support the callback parameter for AJAX/JSONP web applications. Just append ?callback=function to the end of the JSONTest URL. For example, calling http://ip.jsontest.com/?callback=someFunction will return your IP address, inside a JSON object, wrapped in the function someFunction.

Comments or ideas? Open a new issue in the GitHub issue tracker (see the GitHub repository link above).

Echo JSON

Returns a JSON object defined by a REST-style URL. Quick example: a request to http://echo.jsontest.com/key/value/one/two will return the following JSON:

{
   "one": "two",
   "key": "value"
}

As noted above, you can wrap this JSON object for AJAX/JSONP web applications by defining a callback parameter.

Date & Time

Sends back the date and time in JSON form (dates and times are formatted for human-suitable output, and reflect the time at GMT, Greenwich Mean Time).

Example: A request to http://date.jsontest.com/ will return JSON that looks like the following:

{
   "time": "08:31:19 PM",
   "date": "05-12-2012"
}

As with the previous Echo JSON service, you can wrap the request in a callback, for AJAX/JSONP services. For example, you can call http://date.jsontest.com/?callback=showDate to retrieve the date/time JSON, wrapped in a function called showDate.

IP Address

Returns the requester's IP address: http://ip.jsontest.com

Headers

Returns the HTTP request headers received from the client. A request to http://headers.jsontest.com/ will return a JSON object similar to this:

{
   "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"
}

Arbitrary Code (Javascript Alerts)

AJAX/JSONP web applications can request not only JSON objects, but Javascript code as well. A request to http://code.jsontest.com/ sends back the below Javascript code:

alert("IP Address: Your IP Address"); 
alert("Browser: Mozilla/5.0 (Windows NT 5.1)... User-Agent string here");

Validation

Validates a JSON object against the org.json 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:

{
   "empty": false,
   "validate": true,
   "size": 1
}

The size parameter counts the number of top level keys inside the JSON object.

If invalid JSON is passed in (we'll remove an apostrophe in the value http://validate.jsontest.com/?json={"key":value"}, then the returned JSON object will note that the parsing failed, and the reason why (as given by the org.json parser).

{
   "error": "Expected a ',' or '}' at 13 [character 14 line 1]",
   "validate": false
}