Loading ...
Sorry, an error occurred while loading the content.

RE: [json] JSON and sorted Data

Expand Messages
  • Mark Ireland
    Could we have a string key and sort the keys before looping over the object? To: json@yahoogroups.com From: navneet@adventnet.com Date: Mon, 14 Jul 2008
    Message 1 of 2 , Jul 14, 2008
    View Source
    • 0 Attachment
      Could we have a string key and sort the keys before looping over the object?

      To: json@yahoogroups.com
      From: navneet@...
      Date: Mon, 14 Jul 2008 08:33:53 +0000
      Subject: [json] JSON and sorted Data






















      JSON does not preserve the data sorting.

      I fetched the sorted data from DB and put in json object to be shown

      in a list box. The sorting order is not preserved because JSONObject

      internally uses a HashMap which does not guarantee the sorting order

      on iteration.



      Can there be an implementation that uses LinkedHashMap which will

      preserve the sorting order.



      I thought of extending the JSONObject but since myHashMap is private

      this would not do. Also if the myHashMap is a Map interface the we can

      use the internal storage object of any Map implementation.
























      _________________________________________________________________
      Want to help Windows Live Messenger plant more Aussie trees?
      http://livelife.ninemsn.com.au/article.aspx?id=443698

      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.