If you have non-numeric keys they should be in insertion order. Search the archives, this is a much discussed topic. On Sep 11, 2011 12:13 AM, "Felipe Gasper" <[email protected]> wrote: > But even that is implementation-specific, right? > > Object key order can be completely random…at least, that’s always been > my understanding. > > -F > > On 9/10/11 9:32 PM, Cryptic Swarm wrote: >> run it through something like this: >> >> function sortKeys(obj) { >> var ret = {} >> Object.keys(obj).sort().forEach(function(name) { >> ret[name] = obj[name] >> }) >> return ret >> } >> >> before passing it to JSON.stringify >> >> >> On Sat, Sep 10, 2011 at 9:14 PM, Felipe Gasper <[email protected] >> <mailto:[email protected]>> wrote: >> >> 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 >> [email protected] <mailto:[email protected]> >> https://mail.mozilla.org/__listinfo/es-discuss >> <https://mail.mozilla.org/listinfo/es-discuss> >> >> > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

