JSON parsing NaN, Infinite, and null (Node.js)



examples/js/json_parse_nan.js
"use strict";

var str = '{ "v" : 42 }';
console.log(JSON.parse(str)); // Object {v: 42} 

str = '{ "n" : null }';
console.log(JSON.parse(str)); // Object {n: null} 

str = '{ "x" : NaN }';
console.log(JSON.parse(str)); // Uncaught SyntaxError: Unexpected token N 

str = '{ "y" : Infinite }';
console.log(JSON.parse(str)); // Uncaught SyntaxError: Unexpected token I

{ v: 42 }
{ n: null }
undefined:1
{ "x" : NaN }
        ^
SyntaxError: Unexpected token N