diff options
author | Felix Geisendörfer <felix@debuggable.com> | 2009-11-16 11:21:23 +0100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2009-11-16 12:40:58 +0100 |
commit | 6e9e61b9dfaef84bb6f5ef97e31b710bf87957f6 (patch) | |
tree | 4dc0d1d06d9f6525ab3495c83ad3a740ea4a5979 /lib/sys.js | |
parent | ca2c7d1745b3fa8d4ef89e657a888ce9b914b354 (diff) | |
download | android-node-v8-6e9e61b9dfaef84bb6f5ef97e31b710bf87957f6.tar.gz android-node-v8-6e9e61b9dfaef84bb6f5ef97e31b710bf87957f6.tar.bz2 android-node-v8-6e9e61b9dfaef84bb6f5ef97e31b710bf87957f6.zip |
Format JSON for inspecting objects
This patch enables formatting for inspecting JSON objects. Example:
p({foo: "bar", deep: {foo: "bar"}})
becomes:
{
"foo": "bar",
"deep": {
"foo": "bar"
}
}
Diffstat (limited to 'lib/sys.js')
-rw-r--r-- | lib/sys.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sys.js b/lib/sys.js index e98686cca0..dbdd21bf52 100644 --- a/lib/sys.js +++ b/lib/sys.js @@ -28,7 +28,7 @@ exports.inspect = function (value) { if (value === undefined) return; try { - return JSON.stringify(value); + return JSON.stringify(value, undefined, 1); } catch (e) { // TODO make this recusrive and do a partial JSON output of object. if (e.message.search("circular")) { |