From c8e41bfaded8bcaa69e4b3ec0776d0be96990f73 Mon Sep 17 00:00:00 2001 From: cdruan <80615570+cdruan@users.noreply.github.com> Date: Sat, 1 Nov 2025 05:56:22 -0700 Subject: [PATCH] Remove redundant code in format/json.js (#9358) * Remove redundant code in format/json.js * Revise json.js --- core/modules/filters/format/json.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/core/modules/filters/format/json.js b/core/modules/filters/format/json.js index 5db3658e74..98f85dd27b 100644 --- a/core/modules/filters/format/json.js +++ b/core/modules/filters/format/json.js @@ -16,12 +16,8 @@ exports.json = function(source,operand,options) { spaces = /^\d+$/.test(operand) ? parseInt(operand,10) : operand; } source(function(tiddler,title) { - var data = $tw.utils.parseJSONSafe(title); - try { - data = JSON.parse(title); - } catch(e) { - data = undefined; - } + var data = $tw.utils.parseJSONSafe(title,function(){return undefined;}); + if(data !== undefined) { results.push(JSON.stringify(data,null,spaces)); }