function.prettyPrintJSON(obj, options) Section |
---|
Column |
---|
| Convert a JSON object into a nicely spaced text string. Code Block |
---|
| javascript |
---|
| javascript |
---|
bgColor | white |
---|
borderStyle | nonejavascript |
---|
|
function.prettyPrintJSON(obj, options);
|
File name: FluidDebugging.js Parameters Span |
---|
| obj
| (Object) The JSON object to print | options
| (Object) (optional) Options configuring how the string is produced. The options will be passed on to JSON.stringify() . |
|
Return Value Span |
---|
| String | A string representation of the JSON object. |
|
|
| Example Code Block |
---|
|
var myObject = {
arr1: ["foo", "bar"],
obj1: {
subObj1: "Foo",
subObj2: "Bar"
}
};
var string = fluid.prettyPrintJSON(myObject);
|
In this example, the results string will contain Code Block |
---|
|
"{\n arr1: [\"foo\", \"bar\"],\n obj1: {\n subObj1: \"Foo\",\n subObj2: \"Bar\"\n }\n}"
|
which, when output, would produce Code Block |
---|
|
{
arr1: ["foo", "bar"],
obj1: {
subObj1: "Foo",
subObj2: "Bar"
}
} |
|