Thursday, 19 February 2015

Logan Square


The fastest JSON parsing and serializing library available for Android. Based on Jackson's streaming API, LoganSquare is able to consistently outperform GSON and Jackson's Databind library by 400% or more. By relying on compile-time annotation processing to generate code, you know that your JSON will parse and serialize faster than any other method available.
By using this library, you'll be able to utilize the power of Jackson's streaming API without having to code tedius, low-level code involving JsonParsers orJsonGenerators. Instead, just annotate your model objects as a @JsonObject and your fields as @JsonFields and we'll do the heavy lifting for you.
Don't believe it could improve upon Jackson Databind's or GSON's performance that much? Well, then check out the nifty graphs below for yourself. Not convinced? Feel free to build and run the BenchmarkDemo app included in this repository.


Note that Gradle is the only supported build configuration for LoganSquare. To add the library to your app's build.gradle file.
  apply plugin: ''

  dependencies {
    apt 'com.bluelinelabs:logansquare-compiler:1.0.3'
    compile 'com.bluelinelabs:logansquare:1.0.3'
For the curious, the first line adds the apt plugin, which is what allows us to do compile-time annotation processing. The first dependency is what tells Gradle to process your JSON annotations, and the second dependency is our tiny 19kb runtime library that interfaces with the generated code for you.


Using LoganSquare is about as easy as it gets. Here are a few docs to get you started:


Like all libraries that generate dynamic code, Proguard might think some classes are unused and remove them. To prevent this, the following lines can be added to your proguard config file.
-keep class com.bluelinelabs.logansquare.** { *; }
-keep class **$$JsonObjectMapper { *; }

Why LoganSquare?

We're BlueLine Labs, a mobile app development company based in Chicago. We love this city so much that we named our company after the blue line of the iconic 'L.' And what's one of the most popular stops on the blue line? Well, that would be Logan Square of course. Does it have anything to do with JSON? Nope, but we're okay with that.

No comments:

Post a Comment