jsonlint
jsonlint copied to clipboard
unicode escaping in strings is not parsed correctly
Jsonlint does not parse strings with unicode escape characters correctly. Instead of parsing the unicode \uXXXX
it's escaping it, so the resulting string is wrong.
e.g.: parsing '{\n"name": "\\u30d0\\u30b0"\n}\n'
results in { name: '\\u30d0\\u30b0' }
but should be { name: '\u30d0\u30b0' }
Here is the code to reproduce the error:
var jsonlint = require("jsonlint");
var test = '{"name": "\\u30d0\\u30b0"}';
var jsonlintRes = jsonlint.parse(test);
var jsonparseRes = JSON.parse(test);
console.log("PARSE SAME?", jsonlintRes === jsonparseRes);
console.log("jsonlint result:", jsonlintRes);
console.log("JSON.parse result:", jsonparseRes);