Possible Duplicate:
Sorting JavaScript Object by property value
自2006年以来 我已经注意到,浏览器可以保证发出“JSON trough anjax”电话(参赛人/参赛人)的顺序,我感到有些麻烦的是,在接到“jax”电话后将JSON元素与javascript混在一起。
I ve found some topics about this issue, but nothing gave me a clear solution for the simple structure of my JSON object. I just got 1 segment with a lot of data. I know there are a lot of topics about this, even on stackoverflow, but no topic handles this simple json structure.
例如:
{
"158":"Banana",
"265":"Pear",
"358":"Apple",
"864":"Peach"
}
How can I sort this object on the fruitnames instead of the id s? I d like to have this object at the end:
{
"358":"Apple",
"158":"Banana",
"864":"Peach"
"265":"Pear",
}
提前感谢。