Remove redundant code in format/json.js (#9358)

* Remove redundant code in format/json.js

* Revise json.js
This commit is contained in:
cdruan
2025-11-01 05:56:22 -07:00
committed by GitHub
parent fb4d417629
commit c8e41bfade

View File

@@ -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));
}