In javascript, I want to use JSON.stringify
. But some (older) browsers do not recognize JSON
as a defined object. Is there a javascript file that I can include that defines JSON, and all it's awesome functionality, for browsers that do not natively support JSON
?
I should note that I'm referring to a specifically defined JSON
object, rather than the more general concept of javascript object notation.
Douglas Crockford (the inventor of JSON) provides json2.js, an efficient JSON "parser" that doesn't actually parse JSON; it uses regular expressions to sanitise JSON before passing it to eval, and falls back on native JSON support if the browser has it.
He also provides a more conventional recursive-descent parser and a state-machine-based parser in the same repo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With