0

Is there any easy way to sort a JSONArray of objects by an attribute in Android?

Erick Robertson
  • 32,125
  • 13
  • 69
  • 98
ninjasense
  • 13,756
  • 19
  • 75
  • 92
  • Possible duplicate of [How can I sort a JSONArray in JAVA](http://stackoverflow.com/questions/19543862/how-can-i-sort-a-jsonarray-in-java) – Vito Gentile Nov 15 '16 at 14:59

1 Answers1

1

Perhaps using the Google GSON library you can deserialise the array to a typed collection of objects, and then using Collections perform a sort.

Look at 6th line in on the following link.. Looks a bit messy but might be quickest way..

http://sites.google.com/site/gson/gson-user-guide#TOC-Collections-Examples

David Brown
  • 3,021
  • 3
  • 26
  • 46