Js sorts the Json array
Due to the need for conversion of various data types to process data with java, it is very depressing, and individuals prefer to use js for data processing. I hope it will be helpful to you to go to code directly:
Function sortJsonArr (jsonArr, sortName, sortType) {if (sortName & & sortType & & jsonArr! = null & & jsonArr.length > 0) {sortType = sortType.toUpperCase (); var direction = 1; if (sortType = 'DESC') {direction =-1 } jsonArr.sort (function (obj1, obj2) {if (obj1 [sortName] > obj2 [sortName]) {return 1 * direction;} else {return-1 * direction;}}) }}