- json_decode: documentation ( source)
- asort: documentation ( source)
- json_encode: documentation ( source)
<?php
$arr = json_decode('{"528":5,"527":1,"526":2,"524":6}',1); //<--- converting the object to an array , by passing second arg 1
asort($arr);// sorting the array in ascending ....
$arr = json_encode($arr); //encoding back !
echo $arr;