Merge pull request #177 from Znuff/patch-1

Fix for #176
This commit is contained in:
Khanh Ngo 2018-03-30 14:11:15 +07:00 committed by GitHub
commit 5bd5dd8d18

View File

@ -167,7 +167,7 @@ json_library = {
return r + (pEnd || ''); return r + (pEnd || '');
}, },
prettyPrint: function(obj) { prettyPrint: function(obj) {
obj = obj.replace(/u'/g, "\'").replace(/'/g, "\"").replace(/(False|None)/g, "\"$1\""); obj = obj.replace(/"/g, "\\\"").replace(/u'/g, "\'").replace(/'/g, "\"").replace(/(False|None)/g, "\"$1\"");
var jsonData = JSON.parse(obj); var jsonData = JSON.parse(obj);
var jsonLine = /^( *)("[\w]+": )?("[^"]*"|[\w.+-]*)?([,[{])?$/mg; var jsonLine = /^( *)("[\w]+": )?("[^"]*"|[\w.+-]*)?([,[{])?$/mg;
return JSON.stringify(jsonData, null, 3) return JSON.stringify(jsonData, null, 3)
@ -175,4 +175,4 @@ json_library = {
.replace(/</g, '&lt;').replace(/>/g, '&gt;') .replace(/</g, '&lt;').replace(/>/g, '&gt;')
.replace(jsonLine, json_library.replacer); .replace(jsonLine, json_library.replacer);
} }
}; };