Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance and Usability comparison of Android JSON libraries [closed]

Tags:

java

json

android

What is the best library out there for parsing JSON on android. I know the Android framework has a JSON library built in, and I've heard of GSON. But I'm wondering if anyone has compared the various JSON options on android and come up with a justification for choosing one over the other. I'm thinking of performance and usability as the main criteria.

like image 758
Kurtis Nusbaum Avatar asked Oct 28 '11 21:10

Kurtis Nusbaum


People also ask

Which is faster GSON or Jackson?

The tally for fastest library on number of files won is: GSON – 14. JSONP – 5. Jackson – 1.

Is GSON better than JSON?

GSON can use the Object definition to directly create an object of the desired type. While JSONObject needs to be parsed manually.

What is JSON library?

JSON (JavaScript Object Notation, pronounced /ˈdʒeɪsən/; also /ˈdʒeɪˌsɒn/) is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays (or other serializable values).


1 Answers

While there is a handful of Java-to/from-JSON APIs that provide for easy (basic) binding between JSON and an arbitrary Java data structure, Jackson and Gson are by far the most sophisticated (capable) and feature-rich options.

Back in July (2011), I posted a multi-part series on my blog comparing using Gson versus Jackson, stepping through features as they were organized in the Gson User Guide, including examples of comparable implementations in Jackson (and of implementations in Gson, where the Gson User Guide was incomplete or broken).

The sixth part of the series provides easy navigation links for the comparison, as well as a summary comparison listing. http://programmerbruce.blogspot.com/2011/07/gson-v-jackson-part-6.html

This is the most comprehensive comparison of using Gson versus Jackson for common JSON-to/from-Java tasks known.

As mentioned, performance comparisons of various Java-to/from-JSON APIs are available at https://github.com/eishay/jvm-serializers/wiki. The current release of Gson (2.0) shows to be about 16 times slower than the current release of Jackson (1.9.2) at serializing and deserializing a 500 byte JSON structure, using very comparable implementation efforts (just one or two lines of code).

Martin Adamek posted some performance results of various APIs running on Android at http://martinadamek.com/2011/01/31/comparison-of-json-parsers-performance-on-android/ and http://martinadamek.com/2011/02/04/json-parsers-performance-on-android-with-warmup-and-multiple-iterations/

like image 142
Programmer Bruce Avatar answered Oct 14 '22 03:10

Programmer Bruce