Take the 2-minute tour ×

I have a huge JSON file to parse in my Android app. I suppose it is too big to parse it, probably the memory won't be enough. I usually parse just small file with GSON lib.

Is there a best practice for that? Or, do you suggest something to work it out?

Any suggestions is well appreciated.

share|improve this question
wait, what! 19MB...? really??? damnnnn :) –  waqaslam Mar 29 '12 at 8:47
add comment

3 Answers

up vote 1 down vote accepted

You're definitely going to need to use a streaming parser like JsonReader. It's available both in Gson (link) and in Android 3.0+ (link). You should use skipValue() aggressively since that avoids allocating objects that you aren't going to use.

share|improve this answer
add comment

For Parsing GSON is good where by making POJO you can parse JSON object to directly Java Object. and for the lengthy file you must do this in a separate thread i.e other than UI Thread For this You can Use AsyncTask a Utility for Managing thread. below is complete refrence to it


share|improve this answer
add comment

If you use Jackson, make sure you use the streaming API instead of the databind API, then remember to use skipChildren() as agressively as possible. An example of using the streaming API is available here.

share|improve this answer
add comment

Your Answer


