Scenario: Consider I have a JSON documents as follows:
{
\"name\": \"David\",
\"age\" : 78,
\"NoOfVisits\" : 4
}
As already noted, JavaScript object properties have no guaranteed order (think of it, does it make any sense to have one?).
If you really need to have an order, you could use an array as:
[{"name" : "Dave"}, {"age" : 78}, {"NoOfVisits" : 4}]
or:
["Dave", 78, 4] // but here you have no idea what is happening
I wouldn't want to see any of these in my code. So a better idea is to re-think what you are trying to achieve.