This functionality is Sneak Peek status. This means that the APIs may change. We welcome your feedback, ideas, and code, but please use caution if you use this new functionality.
function.prettyPrintJSON(obj, options)
Convert a JSON object into a nicely spaced text string.
function.prettyPrintJSON(obj, options);
File name: FluidDebugging.js
Parameters
obj |
(Object) The JSON object to print |
options |
(Object) (optional) Options configuring how the string is produced |
Return Value
String | A string representation of the JSON object. |
See Also
Example
var myObject = { arr1: ["foo", "bar"], obj1: { subObj1: "Foo", subObj2: "Bar" } }; var string = fluid.prettyPrintJSON(myObject);
In this example, the results string
will contain
"{\n arr1: [\"foo\", \"bar\"],\n obj1: {\n subObj1: \"Foo\",\n subObj2: \"Bar\"\n }\n}"
which, when output, would produce
{ arr1: ["foo", "bar"], obj1: { subObj1: "Foo", subObj2: "Bar" } }