The goog.format.JsonPrettyPrinter Class

goog.format.JsonPrettyPrinter(delimiters)

Formats a JSON object as a string, properly indented for display. Supports displaying the string as text or html. Users can also specify their own set of delimiters for different environments. For example, the JSON object: {"a": 1, "b": {"c": null, "d": true, "e": [1, 2]}} Will be displayed like this: { "a": 1, "b": { "c": null, "d": true, "e": [ 1, 2 ] } }

delimiters {goog.format.JsonPrettyPrinter.TextDelimiters}
Container for the various strings to use to delimit objects, arrays, newlines, and other pieces of the output.

The goog.format.JsonPrettyPrinter.HtmlDelimiters Class

A container for the delimiting characters used to display the JSON string to an HTML <pre> or <code> element. … more

The goog.format.JsonPrettyPrinter.TextDelimiters Class

A container for the delimiting characters used to display the JSON string to a text display. Each delimiter is a publicly accessible property of the object, which makes it easy to tweak delimiters to specific environments. … more

.format(json)

Formats a JSON object as a string, properly indented for display.

json {*}
The object to pretty print. It could be a JSON object, a string representing a JSON object, or any other type.
returns {string}
Returns a string of the JSON object, properly indented for display.