JSON: Jackson stream parser - is it really worth it?

android, jackson, json

Solution

Guess you've pretty much answered your own question. :) Using the built-in JSON parser myself and have never looked for an alternative.

EDIT: Now I'm using a thin annotation-based wrapper from DroidParts.

Problem

I'm making pretty heavy use of JSON parsing in an app I'm writing. Most of what I have done is already implemented using Android's built in JSONObject library (is it json-lib?). JSONObject appears to create instances of absolutely everything in the JSON string... even if I don't end up using all of them. My app currently runs pretty well, even on a G1. My question is this: are the speed and memory benefits from using a stream parser like Jackson worth all the trouble? By trouble, I mean this: As far as I can tell, there are three downsides to using Jackson instead of the built in library: - Dependency on an external library. This makes your .apk bigger in the end. Not a huge deal. - Your app is more fragile. Since the parsing is not done automatically, it is more vulnerable to changes in the JSON text that it's parsing (perhaps I'm wrong about this). - Writing code to parse JSON via a stream parser is ugly and tedious.

Original source