Have a node.js app that is receiving JSON data strings that contain the literal NaN, like
\"[1, 2, 3, NaN, 5, 6]\"
This crashes JSON
When you deal with about anything mathematical or with industry data, NaN
is terribly convenient (and often infinities too are). And it's an industry standard since IEEE754.
That's obviously why some libraries, notably GSON, let you include them in the JSON they produce, losing standard purity and gaining sanity.
Revival and regex solutions aren't reliably usable in a real project when you exchange complex dynamic objects.
And eval
has problems too, one of them being the fact it's prone to crash on IE when the JSON string is big, another one being security risks.
That's why I wrote a specific parser (used in production) : JSON.parseMore