Strict JSON uses the YUI JSON utility to parse the input. Invalid input will not be parsed.
{
"empty object": { },
"object": {
"cow": "moo",
"cat": "meow"
},
"empty array": [],
"array": [
"cow",
"cat"
],
"string": "cows go moo",
"number": 123,
"true": true,
"false": false,
"null": null
}
Eval uses the javascript eval function to parse the input. This is less strict about the syntax of the input. This also permits values that would normally be rejected, such as regular expression literals, or functions, or Infinity.
{
invalid: 'should have used double quotes',
"function": function (n) {
return n + 1;
},
"Undefined": undefined,
"Error": new Error("oops"),
"RegEx": /abc/i,
"NaN": NaN,
"Infinity": Infinity
}
HTML output specifies that the resulting structure should be rendered as a series of HTML tables.
JSON output specifies that the JSON should be re-rendered as JSON, but with color coding and indenting, designed to make it more readable.
Preserve whitespace causes strings to be rendered inside of a <pre> element. This option is only available when rendering as HTML.
"\ttabs and\nnew lines\tare more visible."
Detect encoded dates causes dates to be detected and rendered as dates. Dates are detected only if they are in the usual ISO 8601 format.
"1980-01-16T17:10:00Z"
Truncate long strings will cause strings over 70 characters to be cut off for display purposes.
"Very very long things will then cut off before they make your
display too difficult to read, while still showing enough
information to give you an idea as to what they contain."
Detect data structures causes some particular organizations of data to be rendered differently. Specifically, if an object or an array contains a collection of other objects, and at least 66% of those objects are similar to one another, then the parent object will be rendered as a table.
The table will contain one key column (displaying the properties of the parent object or row numbers of the parent array). It will also have additional columns: one for each of the properties of the dominant object type.
This option is only available when rendering as HTML.
{
"example object": {
"row1": {
"col 1": "1 x 1",
"col 2": "2 x 1",
"col 3": "3 x 1"
},
"row2": {
"col 1": "1 x 2",
"col 2": "2 x 2",
"col 3": "3 x 2"
},
"row3": {
"col 1": "1 x 3",
"col 2": "2 x 3",
"col 3": "3 x 3"
}
},
"example array": [
{
"col 1": "1 x 1",
"col 2": "2 x 1",
"col 3": "3 x 1"
},
{
"col 1": "1 x 2",
"col 2": "2 x 2",
"col 3": "3 x 2",
"extra": "item won't break"
},
{
"col 1": "1 x 3",
"col 2": "2 x 3",
"col 3": "3 x 3"
}
]
}
After rendering some JSON, clicking on specific values in the output area will display the necessary path for reaching that value.
Load / Reload will prompt you to enter a URL that is expected to return some form of JSON. The visualizer will attempt to load JSON from that URL and render it using your current settings.
You can also pass a query string parameter to cause a particular
JSON feed to be loaded automatically:
?feed=<<url>>
.
Validate will validate the supplied JSON and produce a list of deviations from the "strict" standard mode. If the JSON is valid, or if it contains only non-critical warnings, the result will also be rendered using your chosen display mode.
Remove Line Breaks will strip away any \n characters from the input. This exists specifically to handle copy-and-pasting JSON out of Firebug's XMLHttpRequest inspection feature from the "Post" tab. Perhaps it has other uses as well.
Decode URI will replace the contents of the Input field with the results of running decodeURIComponent on those contents.
Trim non-JSON will attempt to strip away any non-JSON material from the beginning or end of a JSON object. It does this by looking for matching braces. This would be used to handle copy-and-pasting from a source that may include extra data, for instance, JSON embedded in HTML.
See also: Regular Expression Explaining.