Skip to content
talklittle edited this page Sep 13, 2010 · 3 revisions

Parsers I have tried:

  • Jackson 1.1.1 parser streaming, and Plain Old Java Object mapping in latest versions (1.5). I have been using this parser from the start. Now (April 2010) I think using the mapper functionality might make more sense.
  • Google Gson does mapping to objects too.
  • svenson does too. It seems nice but requires java.beans.Introspection, which seems unavailable on Android 1.6.

http://www.cowtowncoder.com/blog/archives/2009/09/entry_326.html shows that Jackson is fastest by far (vs. Gson and something else, as of September 2009). svenson comparison N/A since I can’t use it on Android.

Pros of streaming parser:

  • You can update progress in-line with parsing.

Cons:

  • You have to be careful about the JSON ordering, where my first implementation was bad. It assumed the JSON had a specific format, which is incorrect to assume.

Pros of JSON-to-Java mapper:

  • Easy
  • Safer

Cons:

  • Can’t update progress in-line with parsing

Conclusion
I need to do some more testing for speed. If the mapper was miraculously really fast compared to the in-line streaming parser, then no need to worry about the updating progress. If they are same speed, I might just go with mapper anyway and disable the progress bar, since the code is really tight with a mapper parser.

Clone this wiki locally