You better use Jackson2
https://github.com/FasterXML/jackson
Java EE 7 has also a new JSON processing API, brand new!
http://docs.oracle.com/javaee/7/api/javax/json/package-summary.html
Profiling the different libs will provide answers. For enterprise applications, I never use GSON.
Answer from Stefaan Neyts on Stack OverflowYou better use Jackson2
https://github.com/FasterXML/jackson
Java EE 7 has also a new JSON processing API, brand new!
http://docs.oracle.com/javaee/7/api/javax/json/package-summary.html
Profiling the different libs will provide answers. For enterprise applications, I never use GSON.
- If you want to write benchmarks, use JMH. Writing high quality benchmarks isn't easy and JMH does a lot of the heavy lifting for you (although there are still a few gotchas).
- If you wonder which Java Json library serializes/deserializes faster for various payload sizes, you can look at this extensive benchmark which compares a dozen of them with JMH. Fasted is dsljson, second is jackson. Gson is actually pretty slow for a 'modern' lib.
The Newest Java Json Benchmark Results just dropped
Actual JSON serialization benchmark for Java-APIs - Stack Overflow
json - Java Jackson Large Object Serialization Optimization - Stack Overflow
android - Jackson JSON Parser performance - Stack Overflow
Here is a one benchmark.
http://code.google.com/p/thrift-protobuf-compare/wiki/Benchmarking
In this article I discuss the importance of re-cycling objects to improve serialisation times.
http://vanillajava.blogspot.co.uk/2011/10/serialization-using-bytebuffer-and.html
IMHO: JSon is one of the most difficult formats to deserialise efficiently, even harder than XML.
Here are two recent ones as of last week. It compares form byte[], reader, inputStream, char[], CharSequence, String, etc.
It compares Boon, Jackson, Smart JSON and GSON.
https://github.com/gatling/json-parsers-benchmark
https://github.com/RichardHightower/json-parsers-benchmark
Boon and Jackson are close on a few. At times Boon is 4x faster. Mostly Boon wins. :) GSON is better than most at I/O, but Boon does best all around (and best at I/O), and it has an index overlay mode that is even faster (look at the second set.. the index overlay puts Boon way over the top).
https://github.com/RichardHightower/boon
I am bias. :)
But gatling is not, and the results are the same. Boon is wicked fast.