So here's the object:
As you can see, the last amount(2000) is lower than 10000 but it's still at the end. I'm trying to display the elements sorted by amount. I know that I have to convert the object to array and use sort on it, but don't have an idea how can I do this properly.
EDIT: I've tried something like this without any success:
var packs_array = [];
jQuery.each(json.purchase_packs, function(i, pack) {
packs_array.push(pack);
});
packs_array.sort();