open-source Java library to serialize and deserialize Java objects to and from JSON
Gson, or Google Gson, is an open-source Java library that serializes Java objects to JSON (and deserializes them back to Java). The Gson library was originally developed for internal purposes at Google, … Wikipedia
Factsheet
Google Gson
Developer Google
Initial release May 22, 2008; 17 years ago (2008-05-22)
Factsheet
Google Gson
Developer Google
Initial release May 22, 2008; 17 years ago (2008-05-22)
🌐
GitHub
github.com › google › gson
GitHub - google/gson: A Java serialization/deserialization library to convert Java Objects into JSON and back · GitHub
A Java serialization/deserialization library to convert Java Objects into JSON and back - google/gson
Starred by 24.3K users
Forked by 4.4K users
Languages   Java
🌐
Javadoc.io
javadoc.io › doc › com.google.code.gson › gson › 2.8.0 › com › google › gson › Gson.html
Gson - gson 2.8.0 javadoc
Latest version of com.google.code.gson:gson · https://javadoc.io/doc/com.google.code.gson/gson · Current version 2.8.0 · https://javadoc.io/doc/com.google.code.gson/gson/2.8.0 · package-list path (used for javadoc generation -link option) https://javadoc.io/doc/com.google.code.gson/gso...
Discussions

How do I install the GSON module in Java - Stack Overflow
Note: the command line in my answer is just meant to demonstrate how to execute YOUR class which in turn is dependent on the Gson library. It is not a command to "install" Gson or so. All you need to do is to specify it in the classpath when compiling and executing YOUR Java program. More on stackoverflow.com
🌐 stackoverflow.com
java - Jackson Vs. Gson - Stack Overflow
After searching through some existing libraries for JSON, I have finally ended up with these two: Jackson Google GSon I am a bit partial towards GSON, but word on the net is that GSon suffers from a More on stackoverflow.com
🌐 stackoverflow.com
[Java] Read GSON into list
Reading lines and joining them is unnesessary. You can wrap the inputStream with InputStreamReader and pass that to gson.fromJson(). More on reddit.com
🌐 r/learnprogramming
4
1
July 27, 2021
java - Creating GSON Object - Stack Overflow
Just an FYI: Gson is really made for converting Java objects to/from JSON. More on stackoverflow.com
🌐 stackoverflow.com
🌐
JSON Formatter
jsonformatter.org › json-viewer
JSON Viewer Online Best and Free
Secure JSON Viewer is online JSON Viewer tool to Visualize JSON data in Tree View.
🌐
JSON Editor Online
jsoneditoronline.org
JSON Editor Online: edit JSON, format JSON, query JSON
JSON Editor Online is the original and most copied JSON Editor on the web. Use it to view, edit, format, repair, compare, query, transform, validate, and share your JSON data.
🌐
GitHub
google.github.io › gson › UserGuide.html
Gson User Guide | gson
Gson is a Java library that can be used to convert Java Objects into their JSON representation.
🌐
Maven Repository
mvnrepository.com › artifact › com.google.code.gson › gson
Maven Repository: com.google.code.gson » gson
September 10, 2025 - Gson is a Java library that can be used to convert Java Objects into their JSON representation.
Find elsewhere
🌐
TutorialsPoint
tutorialspoint.com › gson › gson_quick_guide.htm
GSON - Quick Guide
Google Gson is a simple Java-based library to serialize Java objects to JSON and vice versa. It is an open-source library developed by Google. The following points highlight why you should be using this library − Here is a list of some of the most
🌐
Readthedocs
jse.readthedocs.io › en › latest › utils › gson › index.html
Gson — Java Repositories 1.0 documentation
Java Repositories 1.0 documentation · Show source · Suggest edit · Open issue · .rst · .pdf · Gson · Goals · Download · Documentation · References · Convert JSON to a Map · Passing Map.class · Using TypeToken · Using Custom JsonDeserializer · Results · References ·
🌐
TutorialsPoint
tutorialspoint.com › gson › index.htm
Google Gson Tutorial
Google Gson is an open source, Java-based library developed by Google. It facilitates serialization of Java objects to JSON and vice versa. This tutorial adopts a simple and intuitive way to describe the basic-to-advanced concepts of Google Gson and
🌐
Java Guides
javaguides.net › 2024 › 05 › guide-to-gson-library-in-java.html
Guide to GSON Library in Java
May 17, 2024 - GSON is a Java library developed by Google for converting Java objects to JSON and vice versa. It is lightweight, easy to use, and highly customizable
Top answer
1 of 5
137

I did this research the last week and I ended up with the same 2 libraries. As I'm using Spring 3 (that adopts Jackson in its default Json view 'JacksonJsonView') it was more natural for me to do the same. The 2 lib are pretty much the same... at the end they simply map to a json file! :)

Anyway as you said Jackson has a + in performance and that's very important for me. The project is also quite active as you can see from their web page and that's a very good sign as well.

2 of 5
89

Jackson and Gson are the most complete Java JSON packages regarding actual data binding support; many other packages only provide primitive Map/List (or equivalent tree model) binding. Both have complete support for generic types, as well, as enough configurability for many common use cases.

Since I am more familiar with Jackson, here are some aspects where I think Jackson has more complete support than Gson (apologies if I miss a Gson feature):

  • Extensive annotation support; including full inheritance, and advanced "mix-in" annotations (associate annotations with a class for cases where you can not directly add them)
  • Streaming (incremental) reading, writing, for ultra-high performance (or memory-limited) use cases; can mix with data binding (bind sub-trees) -- EDIT: latest versions of Gson also include streaming reader
  • Tree model (DOM-like access); can convert between various models (tree <-> java object <-> stream)
  • Can use any constructors (or static factory methods), not just default constructor
  • Field and getter/setter access (earlier gson versions only used fields, this may have changed)
  • Out-of-box JAX-RS support
  • Interoperability: can also use JAXB annotations, has support/work-arounds for common packages (joda, ibatis, cglib), JVM languages (groovy, clojure, scala)
  • Ability to force static (declared) type handling for output
  • Support for deserializing polymorphic types (Jackson 1.5) -- can serialize AND deserialize things like List correctly (with additional type information)
  • Integrated support for binary content (base64 to/from JSON Strings)
🌐
Reddit
reddit.com › r/learnprogramming › [java] read gson into list
r/learnprogramming on Reddit: [Java] Read GSON into list
July 27, 2021 -

I have the following JSON response from an API:

{
    "offices": [
        {
            "id": "1",
            "city": "louisville",
        },
        {
            "id": "2",
            "city": "phoenix",
        }
    ]
}

I saved the response in a file locally for easy testing.

I am able to read in the file, make a JsonObject in order to get the offices element, and then store the list of Office objects.

Working code:

File file = new File("src/test/resources/offices.json");
InputStream inputStream = new FileInputStream(file);
String json = new BufferedReader(new InputStreamReader(inputStream)).lines().collect(Collectors.joining("\n"));
List<Office> offices = gson.fromJson(
    gson.fromJson(json, JsonObject.class).get("offices"),
    new TypeToken<List<Office>>(){}.getType());

I know Java 8 has introduced a lot of new features. Is there a cleaner way of doing this with lambdas and streams? Just looking for a second pair of eyes to clean up the code if needed.

🌐
IzzyOnDroid
apt.izzysoft.de › fdroid › index › apk › dev.zwander.installwithoptions
Install with Options - IzzyOnDroid F-Droid Repository
a static analysis tool for Java that catches common programming mistakes at compile-time. Google Gson (Utility) A Java serialization/deserialization library to convert Java Objects into JSON and back. libsu (Utility) library that provides APIs to a Unix (root) shell.
🌐
GeeksforGeeks
geeksforgeeks.org › java › how-to-setup-gson-for-java-application
How to Setup GSON For Java Application? - GeeksforGeeks
August 30, 2021 - GSON is Google's JSON parser. It is used to parse JSON files and generate JSON files. It has multiple APIs which serialize Java objects to JSON and deserializes JSON files to Java objects.
🌐
Jenkov
jenkov.com › tutorials › java-json › gson.html
GSON - Java JSON Tutorial
February 18, 2016 - GSON is Google's JSON parser and generator for Java. Google developed GSON for internal use but open sourced it later. GSON it reasonably easy to use, but in my opinion not as elegant as Jackson or Boon (the winner in my opinion).
🌐
GeeksforGeeks
geeksforgeeks.org › java › convert-java-object-to-json-string-using-gson
Convert Java Object to Json String using GSON - GeeksforGeeks
July 11, 2025 - JSON is highly recommended to transmit ... the following methods can be used: GSON: It is an open-source Java library which is used to serialize and deserialize Java objects to JSON....