4 ms·
I don't think it's intended as a replacement for the native functions, rather an implementation to use where they're missing (which, AFAIK, is rare nowadays).
by udp 15y ago
I don't think it's intended as a replacement for the native functions, rather an implementation to use where they're missing (which, AFAIK, is rare nowadays).
- spicyj 15y agoIf you read the description on the page, it says that they fix certain broken aspects of some native implementations.
- jdd 15y ago@spicyj I agree that recklessly paving natives is no good and can cause problems, but JSON3 is trying rather hard to not pave them (note that it doesn't even extend Date.prototype), and only paves parse/stringify when fixing broken implementations that are not cross-browser consistent or spec-compliant. With the fix in place it means the API will produce consistent output cross-browser which is a good thing.
- kitcambridge 15y agoThat's correct. Currently, Firefox is the only browser that implements the JSON routines exactly as described in the spec (parsing since version 5.0, and serializing since 6.0)...others deviate in one or more ways. It's not so much of a concern if you're targeting multiple browsers, as Firefox will correctly throw a `SyntaxError` when given malformed input, but it can certainly become problematic if you're relying on non-standard extensions in only one or two browsers.