JSON parser grammar

Douglas Crockford douglas at crockford.com
Sat Jul 4 19:01:01 PDT 2009


Hallvord R. M. Steen wrote:
> Another question: The JSON grammar says
> 
> JSONNumber :: 
> -opt  DecimalIntegerLiteral JSONFraction opt  ExponentPart opt 
> 
> 
> JSONFraction :: 
> . DecimalDigits 
> 
> This apparently makes numbers like "1." illegal? Should this really throw:
> 
> JSON.parse('[1.]') ?
> 
> And what about
> JSON.parse('[1.e10]') ?
> 
> Both are of course allowed in normal JavaScript source text.

There are lots of things accepted by JavaScript that are not part of JSON.


More information about the es-discuss mailing list