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
Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object.
Starred by 24.4K users
Forked by 4.4K users
Languages   Java
🌐
GitHub
google.github.io › gson › UserGuide.html
Gson User Guide | gson
Compact Vs. Pretty Printing for JSON Output Format ... Gson is a Java library that can be used to convert Java Objects into their JSON representation.
🌐
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/gson/2.8.0/package-list ·
🌐
Mkyong
mkyong.com › home › java › convert java objects to from json using gson
Convert Java objects to from JSON using Gson - Mkyong.com
May 6, 2024 - Gson gson = new Gson(); // A Java object Staff obj = new Staff(); // Converts Java object to JSON string String json = gson.toJson(obj); // Converts Java object to File try (Writer writer = new FileWriter("staff.json")) { gson.toJson(staff, writer); } catch (IOException e) { throw new RuntimeException(e); }
🌐
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.
🌐
Wikipedia
en.wikipedia.org › wiki › Gson
Gson - Wikipedia
October 30, 2025 - Gson, or Google Gson, is an open-source Java library that serializes Java objects to JSON (and deserializes them back to Java).
Find elsewhere
🌐
Twilio
twilio.com › en-us › blog › developers › tutorials › building-blocks › java-json-with-gson
Two ways to use Gson for JSON in Java | Twilio
June 13, 2025 - This is common in JSON documents as it avoids precision issues on very small or very large numbers. Gson allows you to read JSON into a tree model: Java objects that represent JSON objects, arrays and values.
🌐
Medium
medium.com › @alexandre.therrien3 › personalized-serializer-and-deserializer-using-java-gson-library-c079de3974d4
Building a Personalized Serializer and Deserializer using Java Gson Library | by Alex Therrien | Medium
June 2, 2020 - There are only some rare cases where this needs to be done. I did it because I created my own linked list and wanted to convert it into JSON. By default, Gson can automatically convert objects to their corresponding JSON format.
🌐
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
🌐
Javadoc.io
javadoc.io › doc › com.google.code.gson › gson › 2.8.5 › com › google › gson › Gson.html
Gson - gson 2.8.5 javadoc
Latest version of com.google.code.gson:gson · https://javadoc.io/doc/com.google.code.gson/gson · Current version 2.8.5 · https://javadoc.io/doc/com.google.code.gson/gson/2.8.5 · package-list path (used for javadoc generation -link option) https://javadoc.io/doc/com.google.code.gson/gson/2.8.5/package-list ·
🌐
HowToDoInJava
howtodoinjava.com › home › gson › gson tutorial: read and write json with examples
Gson Tutorial: Read and Write JSON with Examples
August 27, 2023 - Pretty Printing for JSON Output Format – The default JSON output that is provided by Gson is a compact JSON format. Use the Pretty Print feature to format the JSON for reading purposes. Mapping of Arrays and Lists of Objects – Learn to use Google GSON library to deserialize or parse JSON, containing JSON arrays, to Java arrays or List objects.
🌐
Baeldung
baeldung.com › home › json › save data to a json file with gson
Save Data to a JSON File with GSON | Baeldung
January 8, 2024 - Gson is a Java library that allows us to convert Java Objects into a JSON representation.
🌐
Medium
medium.com › @dannydamsky99 › heres-why-you-probably-shouldn-t-be-using-the-gson-library-in-2018-4bed5698b78b
Here’s why you probably shouldn’t be using the Gson library in 2018 | by Danny Damsky | Medium
August 28, 2018 - Here’s why you probably shouldn’t be using the Gson library in 2018 Preface Gson is the most popular JSON parsing library on GitHub. It has over 13,000 stars and the numbers are only growing …
🌐
Jenkov
jenkov.com › tutorials › java-json › gson.html
GSON - Gson
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).
🌐
Vogella
vogella.com › tutorials › JavaLibrary-Gson › article.html
Google Gson for converting Java objects to JSON and JSON to Java with - Tutorial
February 26, 2026 - By default, Gson tries to map all fields in the Java object to the JSON file it creates and vice versa. But Gson allows to exclude certain fields for serialization and deserialization. GSon can for example not serialize Java Beans, as the IPropertyChangeSupport field lead to an infinite loop.
🌐
Spring
docs.spring.io › spring-boot › index.html
Spring Boot :: Spring Boot
Spring Boot helps you to create stand-alone, production-grade Spring-based applications that you can run. We take an opinionated view of the Spring platform and third-party libraries, so that you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration ...
🌐
Baeldung
baeldung.com › home › json › gson serialization cookbook
Gson Serialization Cookbook | Baeldung
October 18, 2019 - First, let’s serialize an array of objects with Gson: @Test public void givenArrayOfObjects_whenSerializing_thenCorrect() { SourceClass[] sourceArray = {new SourceClass(1, "one"), new SourceClass(2, "two")}; String jsonString = new Gson().toJson(sourceArray); String expectedResult = "[{"intValue":1,"stringValue":"one"},{"intValue":2,"stringValue":"two"}]"; assertEquals(expectedResult, jsonString); } Next, let’s do the same for a Collection of objects: @Test public void givenCollection_whenSerializing_thenCorrect() { Collection<SourceClass> sourceCollection = Lists.newArrayList(new SourceCl
🌐
Premier League
premierleague.com › en › cookie-policy
Cookie Policy | Premier League
To read the Premier League Cookie Policy, visit the official website of the Premier League.
🌐
Maven Repository
mvnrepository.com › artifact › com.fasterxml.jackson.core › jackson-databind
Maven Repository: com.fasterxml.jackson.core » jackson-databind
1 week ago - Jackson Core is a core library for Jackson that provides low-level streaming JSON input/output functionality.