I have a Josn file containing array of objects like :
{
\"tId\": \"Something\",
\"StartTime\": \"05/29/2013 5:28:33 PM\",
\"CompleteTime\": \"05/29/
You should create a class MyObject
to hold a data of one object (tId, startTime, completeTime, status, machineName).
Then, parse each JsonObject
to MyObject
and add it to a List<MyObject>
.
Then, use Collections.sort()
and a comparator to sort your list.
Your sorting routine will look something like this, depending on the specifics of how you do your JSON/Object mapping:
Collections.sort(myObjectList, new Comparator<MyObject>() {
@Override
int compare(MyObject a, MyObject b) {
if (a.getStartTime().equals(b.getStartTime())) {
return a.getMachineName().compare(b.getMachineName());
}
return a.getStartTime().compare(b.getStartTime());
}
});