because Iβm going to break it with a comma so that it turns into an array, and therefore, when I sort it, I donβt want to sort it according to {and}
zi42 already gave you the correct answer.
But since you wrote above, it looks as if you want to sort the data and break it into an array; in this case, parsing / breaking it into a comma, etc. is a long way to go. Here is another way to think about it:
var data = {foo: 123, bar: <x><y></y></x>, baz: 123}; var key; var dataSorted = [];
You have now sorted the data. When you want to use it, you can use it as follows:
for (var i = 0; i < dataSorted.length; i++) { var key = dataSorted[i];
source share