Closed ian-eulith closed 8 months ago
More minimal test case:
it("should handle number inside string literal", () => {
const nested = '{"x":"12345678901234567,"}';
const result = safeJsonParse(nested);
chai.expect(result).to.deep.eq(JSON.parse(nested));
});
Welcome to submit a pull request with an improvement - will flag this to the team
We hit this bug while trying to use WalletConnect with Dodo.
Test case:
The problem is that safe-json uses a regex to parse big numbers, but this regex does not respect the structure of JSON objects.
It would also be good if the library didn't swallow the error as this causes problems higher-up which are difficult to diagnose.