Android, Google, Programming

Which JSON library should I use in my Android and Java projects? is where you start; this is the prepackaged JSON found in Oracle and Open Java Development Kits. The home page is a useful resource to see all the different JSON libraries out there for all different languages.

GSON is most useful for converting Java objects into their JSON representation. The Google libs can also convert a JSON representation into a Java object; this can be a game-changer for dealing with inheritance.

FlexJSON has a serious strength in web development. Because you can specify deep or shallow copies of objects, you can speed up transmission of information from backend Java code to your front end and client-facing architecture.

Jackson is almost certainly
the fastest JSON parsing library out there; it’s an active project, and has speed and flexibility to recommend it. I have started using it by default. Most useful is the fact that you can switch between a tree model and object mapping at will. It has a JSONFactory method that is extremely useful when parsing and manipulating JSON representations that need to be read, processed, and rewritten to provide data to an Android app.

JSON-lib is mostly focused on translation. Need to translate objects and data back and forth between Java objects, beans, servlets, and DynaBeans? This is the lib to use. Notably, it’s a bit heavy, as you might expect from a translation-centric library, so it’s probably best used when you’re managing legacy code or are a one-woman-shop.

3 thoughts on “Which JSON library should I use in my Android and Java projects?

  1. You might also want to consider Genson
    It tries to stand between Jackson speed and features, Gsons simplicity and provide more flexibility/extensibility ("you can not think of all the use cases, so give the user the ability to implement new features in a easy and clean way").
    If you are interested have a look at the first page, it details more precisely Gensons goals.


      1. Heh yeah, the hardest is to find the balance between speed and openess to extension.
        As you need to write very specific fine tuned and some times ugly code. Trying to be open to extension prevents often to bring such optimizations. If you take a look at it I'll be really interested in your feedback 🙂

Leave a Reply