sort keys with JSON.stringify()

Douglas Crockford douglas at crockford.com
Sun Sep 11 15:05:25 PDT 2011


On 11:59 AM, Felipe Gasper wrote:
> Is it possible to get sorted keys:
>
> {a:1,c:3}
>
> …from running JSON.stringify when declaring an object thus:
>
> {c:3,a:1}
JSON objects are unordered. If order is important, then use an array.


More information about the es-discuss mailing list