sort keys with JSON.stringify()

David Bruant david.bruant at
Sun Sep 11 10:55:48 PDT 2011

Key orders is supposed to follow the order used in Object.keys (step 6
after "The abstract operation /JO/(/value/) serializes an object.")
which is the order of for-in loops which is supposed to be
implementation specific.

However, engines have, in practice, followed more or less the same way
of ordering keys which means that there would be some de-facto standard
that the commitee is discussing to standardize (as far as I know). See (and
discussion at the end)


Le 11/09/2011 04:14, Felipe Gasper a écrit :
> Hello,
>     Is it possible to get sorted keys:
> {a:1,c:3}
> …from running JSON.stringify when declaring an object thus:
> {c:3,a:1}
> ??
> -FG
> _______________________________________________
> es-discuss mailing list
> es-discuss at

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list