From 368b0571046f202f8522b4b8b04ac9a3ffb8cb7b Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 7 Jun 2019 21:22:52 -0400 Subject: [PATCH] Use toJSON() if available when running Zotero.debug() on objects --- chrome/content/zotero/xpcom/utilities.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index 69dfb6308f..c242e32839 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -1414,8 +1414,8 @@ Zotero.Utilities = { return '' + obj; } } - else if (type == 'string') { - return JSON.stringify(obj); + else if (type == 'string' || typeof obj.toJSON == 'function') { + return JSON.stringify(obj, false, ' '); } else if (type == 'function') { var funcStr = ('' + obj).trim();