I'm just a JS guy trying to understand the world around me and documenting what I find, not trying to be discourteous (or even courteous). I'll add the note about Python, thanks for calling it out. FWIW JS does not have a similar capability so I can't add a note there.
jbboehr|1 year ago
This example on MDN seems to indicate that you can, am I misunderstanding it?
[0]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...js2|1 year ago
The optional `context` parameter is a tc39 proposal. The feature compatibility matrix on the bottom of the MDN page is really confusing because it's showing only when `JSON.parse` was added, not whether the optional `context` parameter is supported.
I've confirmed it's available in:
But not available in: The original blog post linked to the proposal:https://tc39.es/proposal-json-parse-with-source/
https://github.com/tc39/proposal-json-parse-with-source
This issue links to the various browser engine tracking bugs:
https://github.com/tc39/proposal-json-parse-with-source/issu...
Which are:
• Chrome/V8: https://bugs.chromium.org/p/v8/issues/detail?id=12955
• Firefox/SpiderMonkey: https://bugzilla.mozilla.org/show_bug.cgi?id=1658310
• Safari/JavaScriptCore: https://bugs.webkit.org/show_bug.cgi?id=248031
pzmarzly|1 year ago
With Zod, you can use z.bigint() parser. If you take the "parse any JSON" snippet https://zod.dev/?id=json-type and change z.number() to z.bigint(), it should do what you are looking for.
js2|1 year ago