var data =[ { "cid":1, "name":"aaa", "price":1000 },{ "cid":2, "name":"bbb", "price":150 },{ "cid":3, "name":"ccc", "price":200 },{ "cid":4, "name":"ddd", "price":1500 },{ "cid":5, "name":"eee", "price":1100 } ]
function sortprice(a,b){
//a-b为升序,b-a为降序
return a.price-b.price
}
data.sort(sortprice);
//sore之后的data及为按某字段排序后的json