For example, consider the following JSON:
{ "this \"key\" is valid": "this \"value\" is valid" }
With limit: 0, this would result in the following JS:
module.exports = JSON.parse(`{"this \"key\" is valid":"this \"value\" is valid"}`)
However, trying to evaluate this JS results in a syntax error:
Uncaught SyntaxError: Unexpected token k in JSON at position 8
at JSON.parse (<anonymous>)
at <anonymous>:1:6
The error is correct. Since the quotes are only escaped once, they "appear" escaped to the template string but unescaped to the JSON parser, resulting in a syntax error.
Properly escaped it would look something like this:
module.exports = JSON.parse('{"this \\"key\\" is valid":"this \\"value\\" is valid"}')
I will open a pull request to fix this issue and add test cases.