4
I have a JSON value that I want to order it in descending order (I think in the example will give to understand).
Example:
var json = {
'um': {
'cont': '5'
},
'dois': {
'cont': '10'
}
...
};
So in this case, it should be ordered by the 'cont' value of each son of json.
In the example I used fixed values, but in the code I will use will have many more children in json and the cont values will be different too.
I think I understand, but in the end the figure should be: ['two', 'one'];
Two remarks to guide future visitors to this question: 1) this is not JSON, it is a literal Javascript object (JSON would serialize that as a string); 2) objects in js are not ordered, you need an array, as indicated in Miguel Angelo’s answer.
– bfavaretto