JSON parsing NaN, Infinite, and null
examples/js/json_parse_nan.html
<script> 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 </script>
Object { v: 42 } json_parse_nan.html:3:0 Object { n: null } json_parse_nan.html:6:0 SyntaxError: JSON.parse: unexpected character at line 1 column 9 of the JSON data