How to sort JSONArray by its Tag name with ascending and descending on android.
In my application i have a JSON like the following and need to display the data according
It seems to me like the easiest way to do it, rather than "sorting the JSON Array" as you suggest, is to just parse the whole thing into a data structure which contains the information like so:
class Results {
String user_id;
Strung comment_id;
}
Save this as an ArrayList or a [insert favourite List structure].
Once you've parsed the entire JSON Array, you can then sort your ArrayList based on the user_id field using Collections.sort
, giving you them in order