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
]
}
}
Instance Method Summary | |
format(<Any Type> json) ⇒ string Formats a JSON object as a string, properly indented for display. | |
printName_(string name, ?goog.string.StringBuffer outputBuffer) Prints a property name to the output. | |
printObject_(<Any Type> val, ?goog.string.StringBuffer outputBuffer, number indent) Formats a property value based on the type of the propery. | |
printSpaces_(number indent, ?goog.string.StringBuffer outputBuffer) Print a number of space characters to the output. | |
printValue_((boolean|null|number|string) val, string typeOf, ?goog.string.StringBuffer outputBuffer) Prints a property name to the output. |