From 6e9e61b9dfaef84bb6f5ef97e31b710bf87957f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Geisend=C3=B6rfer?= Date: Mon, 16 Nov 2009 11:21:23 +0100 Subject: [PATCH] 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" } } --- lib/sys.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sys.js b/lib/sys.js index e98686cca0b..dbdd21bf527 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")) {