First load your json string into an object using JSON.parse. Next, once you have the object loaded into JavaScript, you can use the built-in sort method to loop through the elements of the array as many times as needed to sort them based on some logic which returns either a positive number, negative number, or 0 indicating which element should go in front of which or if they're of equal sorting position.
var o=[
{
"_id": "560be5d1b28f247c38a4df98",
"name": "sara",
"location": "hjk",
"price": 2000,
"rating": 4.2,
"__v": 0,
"description":"beautiful"
},
{
"_id": "560be5d1b28f247c20a4df98",
"name": "zara",
"location": "hjk",
"price": 1000,
"rating": 3.2,
"__v": 0,
"description":"amazing"
}
];
var ascending=true;//change to false for descending
o.sort(function(a,b) {
return (a.price - b.price)*(ascending?1:-1);
});
//variable "o" now contains our sorted object.
var json = JSON.stringify(o);//convert back to a string
//now do something with either the "o" object or "json" string