According to MDN documentation for JSON.stringify:
Properties of non-array objects are not guaranteed to be stringified in any particular order. Do
You may want to try JSON.sortify, a little helper that I wrote.
In contrast to the answers given so far, it
undefined
values and functionstoJSON()