title: How to sort array of json objects in java
body: <p>i have two json objects in jsonarray like this</p>
  
  <pre><code>"errorCode": "1",
  "data": [
      {
          "messageId": 590,
          "message": "WvZiT3RPm7feC6Hxsa/Ing==",
          "messageType": "CHAT",
          "sentOn": "01:51 PM, Apr 06, 2013",
  
          "mainParent": 589,
          "officeId": "19",
          "webParent": 590
      },
      {
          "messageId": 589,
          "message": "1A45rtoC3Cy88h73TEvDqQ==",
          "messageType": "CHAT",
          "sentOn": "01:50 PM, Apr 06, 2013",
  
          "parent": 0,
          "signImg": null,
          "mainParent": 589,
          "officeId": "19",
          "webParent": 1
      }
  ]
  </code></pre>
  
  <p>so i want to sort in ascending order based on message id key. i tried with comparator with object type as json object, i am getting error in compareto method. please suggest me </p>