I’m using the org.json.* library for turning my web services’ result (obviously json) into json objects. My problem is that the JSONObject and JSONArray constructors take a long time to build out the objects. I’m not passing a very large amount of data (anywhere between 1 and 100 array items with 3-5 keys each), but even with just 4 or 5 it takes a few seconds for the constructor to finish.
Is there a way to speed this up? Is there a faster library I could be using?
There’s not a whole lot of code to show.
JSONArray arrayjson = new JSONArray(json);
Where json is a String.
You might give gson a try. This article seems to indicate that it has pretty good performance on Android vs the other alternatives. Jackson might be another good alternative.