JSON.stringify space parameter

Douglas Crockford douglas at crockford.com
Wed Jun 3 16:10:38 PDT 2009


Allen Wirfs-Brock wrote:
> One hopefully final concern related to the JSON grammar:
> 
>  
> 
> As currently specified the space parameter to stringify can be a 
> string.  The length of the string is truncated to 10 characters but 
> currently there are no restrictions on characters that make up the 
> string.  That means that stringify may generate a result which is not 
> valid JSON Text and hence would produce a syntax error if passed to 
> JSON.parse.

The intention was to allow strings like ' ' and '\t',
but there is an obvious hazard.


More information about the es5-discuss mailing list