I didn’t expect this is that complex. But I can’t figure out how I can convert my arraylist of custom class to a JSONArray. I understand there is no direct method to do that. So I made arraylist of JSONObjects from my arraylist. Now in order to save this into a JSON file, how can I convert the arraylist of JSONObjects to JSONArray?
Share
Like this:
toReturn will then be a JSONArray that has all the JSONObjects from your arraylist of JSONObjects in it.