I have a JSON array, and I want to sort it Depending on the name and too alphabetically. My Json is as follows.
[
{
\"UserID\": 77,
\"Inv
Firstly, parse the json data and add every json object to List of Object (e.g. Employee)
List employees = parseJson(jsonDate);
Collections.sort(employees, new EmployeeComparator());
Here is the comparator implementation:
class EmployeeComparator implements Comparator {
@Override
public int compare(Employee o1, Employee o2) {
return o1.getName().compareTo(o2.getName());
}
}