PackageTrack
Sign in Get early access

com.google.code.gson:gson

2.14.0 #480 most downloaded on Maven Central google/gson

What this package is like to depend on

Last release 4 months ago

23 Apr 2026

Release timing varies

gaps range from 2 weeks to 1.4 years

Nearly every release is documented

notes for 42 of 43 stable releases

Nothing withdrawn

no release was ever pulled

18 years old

44 releases · first in 2008

3 releases in the last 12 months

see the full history below

Release timeline

44 releases · Aug 2008 to Apr 2026
2009 2011 2013 2015 2017 2019 2021 2023 2025
Release Pre-release

Releases

latest 44
  1. 2.14.0 23 Apr 2026
    Release notes

    What's Changed

    • Add type adapters for java.time classes by @eamonnmcmanus in #2948

      When the java.time API is available, Gson automatically can read and write instances of classes like Instant and Duration. The format it uses essentially freezes the JSON representation that ReflectiveTypeAdapterFactory established by default, based on the private fields of java.time classes. That's not a great representation, but it is understandable. Changing it to anything else would break compatibility with systems that are expecting the current format.

      With this change, Gson no longer tries to access private fields of these classes using reflection. So it is no longer necessary to run with --add-opens for these classes on recent JDKs.

    • Remove com.google.gson.graph by @eamonnmcmanus in #2990.

      This package was not part of any released artifact and depended on Gson internals in potentially problematic ways.

    • Validate that strings being parsed as integers consist of ASCII characters by @eamonnmcmanus in #2995

      Previously, strings could contain non-ASCII Unicode digits and still be parsed as integers. That's inconsistent with how JSON numbers are treated.

    • Fix duplicate key detection when first value is null by @andrewstellman in #3006

      This could potentially break code that was relying on the incorrect behaviour. For example, this JSON string was previously accepted but will no longer be: {"foo": null, "foo": bar}.

    • Remove Serializable from internal Type implementation classes. by @eamonnmcmanus in #3011

      The nested classes ParameterizedTypeImpl, GenericArrayTypeImpl, and WildcardTypeImpl in GsonTypes are implementations of the corresponding types (without Impl) in java.lang.reflect. For some reason, they were serializable, even though the java.lang.reflect implementations are not. Having unnecessarily serializable classes could conceivably have been a security problem if they were part of a larger exploit using serialization. (We do not consider this a likely scenario and do not suggest that you need to update Gson just to get this change.)

    • Add LegacyProtoTypeAdapterFactory. by @eamonnmcmanus in #3014

      This is not part of any released artifact, but may be of use when trying to fix code that is currently accessing the internals of protobuf classes via reflection.

    • Make AppendableWriter do flush and close if delegation object supports by @MukjepScarlet in #2925

    Other less visible changes

    New Contributors

    Full Changelog: gson-parent-2.13.2...gson-parent-2.14.0

    Open source →
    Release notes

    Gson 2.14.0 Latest

    Latest

    Compare

    Choose a tag to compare

    Open source →
  2. 2.13.2 10 Sep 2025
    Release notes

    The main changes in this release are just newer dependencies.

    What's Changed

    • Improved packaging of JPMS module declaration in Gson jar
      This fixes an issue where Eclipse and VS Code users could not refer to the Gson module name com.google.gson. See issue #2679.
    • Remove internal class GsonPreconditions by @Marcono1234 in #2879
    • Switch to using central-publishing-maven-plugin by @eamonnmcmanus in #2900

    New Contributors

    Full Changelog: gson-parent-2.13.1...gson-parent-2.13.2

    Open source →
    Release notes

    Gson 2.13.2

    Compare

    Choose a tag to compare

    Open source →
  3. 2.13.2-rc1 10 Sep 2025 pre-release

    Nothing published for this version

  4. 2.13.1 24 Apr 2025
    Release notes

    What's Changed

    • Give FieldNamingStrategy the ability to return multiple String names by @mfriesen in #2776
    • Remove outdated android-proguard-example by @Goooler in #2843
    • Adjust Troubleshooting Guide ProGuard / R8 section by @Marcono1234 in #2844
    • Update dependencies, including the problematic com.google.errorprone:error_prone_annotations:2.37.0.

    New Contributors

    Full Changelog: gson-parent-2.13.0...gson-parent-2.13.1

    Open source →
    Release notes

    Gson 2.13.1

    Compare

    Choose a tag to compare

    Open source →
  5. 2.13.0 11 Apr 2025
    Release notes

    What's Changed

    • A bug in deserializing collections has been fixed. Previously, if you did something like this:

      gson.fromJson(jsonString, new TypeToken<ImmutableList<String>>() {})
      

      then the inferred type would be ImmutableList<String>, but Gson actually gave you an ArrayList<String>. Usually that would lead to an immediate ClassCastException, but in some circumstances the code might sometimes succeed despite the wrong type. Now you will see an exception like this:

      com.google.gson.JsonIOException: Abstract classes can't be instantiated!
      Adjust the R8 configuration or register an InstanceCreator or a TypeAdapter for this type.
      Class name: com.google.common.collect.ImmutableList
      

      because Gson now really is trying to create an ImmutableList through its constructor, but that isn't possible.
      Either change the requested type (in the TypeToken) to List<String>, or register a TypeAdapter or JsonDeserializer for ImmutableList.

    • The internal classes $Gson$Types and $Gson$Preconditions have been renamed to remove the $ characters. Since these are internal classes (as signaled not only by the package name but by the $ characters), client code should not be affected. If your code was depending on these classes then we suggest making a copy of the class (subject to the license) rather than depending on the new names.

    Full Changelog: gson-parent-2.12.1...gson-parent-2.13.0

    Open source →
    Release notes

    Gson 2.13.0

    Compare

    Choose a tag to compare

    Open source →
  6. 2.12.1 30 Jan 2025
    Release notes

    The only difference between this release and 2.12.0 is that OSGi declarations in the Gson jar now specify that com.google.errorprone.annotations is an optional dependency, not a required one. If you do not use OSGi then there is no effective change.

    Open source →
    Release notes

    Gson 2.12.1

    Compare

    Choose a tag to compare

    Open source →
  7. 2.12.0 27 Jan 2025
    Release notes

    What's Changed

    The biggest change is that we no longer support Java 7. People who still need to run on Java 7 will need to use an earlier version of Gson.

    Other changes:

    • Allow registering adapters for JsonElement again by @Marcono1234 in #2789
    • Add nesting limit for JsonReader by @Marcono1234 in #2588
    • Add @CheckReturnValue to our packages. by @cpovirk in #2693
    • Add NullSafeTypeAdapter to prevent TypeAdapter.nullSafe() from returning nested null-safe type adapters (#2729) by @lyubomyr-shaydariv in #2731
    • Support Properties subclasses in GsonTypes.getMapKeyAndValueTypes by @panic08 in #2758
    • Enforce rawType to be a Class in ParameterizedTypeImpl by @panic08 in #2759
    • Remove AccessController usage for enum adapter by @Marcono1234 in #2704
    • Fix typeArguments array not being cloned when resolving ParameterizedType with changed owner by @TBlueF in #2706
    • Remove duplicated declaration of required OSGi execution environment by @HannesWell in #2711
    • Move bnd.bnd file configuration into 'bnd' element of bnd-maven-plugin by @HannesWell in #2712
    • Move enum and JsonElement adapter classes to separate class files by @Marcono1234 in #2727
    • EnumTypeAdapter constructor optimization by @esaulpaugh in #2734
    • OSGi / bnd: Remove the self-Import of gson.annotations by @chrisrueger in #2735

    New Contributors

    Full Changelog: gson-parent-2.11.0...gson-parent-2.12.0

    Open source →
    Release notes

    Gson 2.12.0

    Compare

    Choose a tag to compare

    Open source →
  8. 2.11.0 19 May 2024
    Release notes

    Most important changes

    • Added default ProGuard / R8 rules (@Marcono1234, #2397, #2420; @sgjesse, #2448; @sfreilich)
      If you are using ProGuard or R8 (for example for Android projects) you might not need any special Gson configuration anymore if your classes have a no-args constructor and use @SerializedName for their fields.
    • On Android, Gson now requires API level 21 or newer
    • Added new Strictness API (@marten-voorberg & fellow students, #2437)
      Some of Gson's API is still lenient by default, but you can now use the newly added methods GsonBuilder#setStrictness, JsonReader#setStrictness and JsonWriter#setStrictness with Strictness.STRICT to override this behavior and to instead strictly adhere to the JSON specification when parsing.
    • New FormattingStyle class to allow configuring line breaks in JSON output (@mihnita, #2231)
      Can be set using GsonBuilder#setFormattingStyle and JsonWriter#setFormattingStyle.
    • TypeToken can no longer capture type variables by default (@Marcono1234, #2376)
      This was previously a common source of issues. The newly thrown exception refers to a Troubleshooting Guide article which explains this in more detail and provides suggestions for updating affected code.
    • Added serialization support for anonymous and local classes with a custom adapter (@Marcono1234, #2498)
      This affects for example List implementations returned by libraries such as Guava which are implemented as anonymous class, which were previously serialized as null. Anonymous and local classes without custom adapter will still be serialized as null.
    • Added dependency on com.google.errorprone:error_prone_annotations
      Your project can use Maven or Gradle dependency exclusions to remove the transitive error_prone_annotations dependency from Gson. Or if you are manually maintaining dependencies as JARs in your project you can omit error_prone_annotations. And it should still work correctly.
      But Gson itself does declare it as a required dependency, and if you don't perform any custom configuration, then Maven or Gradle will by default try to download and use it.
    • Many exception messages now refer to the Troubleshooting Guide (@Marcono1234, #2357)
      Feedback regarding the Troubleshooting Guide is appreciated!
    • Officially documented that JVM languages other than Java might not be fully supported, see the README.
    • Guarantee that JsonElement#toString produces JSON output (@Marcono1234, #2659)

    Other changes

    Bug fixes

    • Fixed incorrect JsonPrimitive#equals results for large BigInteger values (@MaicolAntali, #2311)
    • Fixed incorrect JsonPrimitive#equals results for large BigDecimal values (@MaicolAntali, #2364)
    • Fixed JsonReader throwing NumberFormatException instead of MalformedJsonException for malformed Unicode escape sequences (@MaicolAntali, #2337)
    • Fixed TypeToken#getParameterized returning bogus ParameterizedType for non-generic types (@Marcono1234, #2447)
    • Fixed Java Record adapter not working for GraalVM Native Image (@eamonnmcmanus, #2465)
    • Fixed JsonWriter#name not throwing exception when no JSON object is currently being written (@shivam-sehgal, #2475; @Marcono1234, #2476)
    • Fixed Gson#getDelegateAdapter not working properly for @JsonAdapter (@Marcono1234, #2435)
      Note that null is now not allowed as skipPast value anymore, which was previously allowed but undocumented.
    • Fixed GsonBuilder not rejecting type adapters for Object and JsonElement, whose default adapters cannot be overridden (@sachinp97; #2479)
    • Fixed no limits being enforced when deserializing BigDecimal and BigInteger (@Marcono1234, #2510)
      The new limits prevent potential performance problems when user code uses the deserialized numbers. Gson itself was and is not affected by these performance problems. The limits should be high enough to not cause issues for most use cases, but feedback is appreciated.
    • Fixed GsonBuilder#setDateFormat not rejecting invalid date formats (@Carpe-Wang, #2538)
    • Fixed GsonBuilder#setDateFormat not rejecting invalid date styles (@Marcono1234, #2545)
    • Fixed GsonBuilder#setDateFormat ignoring partial DEFAULT style (@Marcono1234, #2556)
    • Fixed TypeToken#isAssignableFrom throwing AssertionError in some cases (@Marcono1234, #2544)
    • Fixed date adapters not restoring time zone after parsing (@Carpe-Wang, #2549)
    • Fixed TypeToken#equals erroneously returning false for equal generic type parameters in some cases (@d-william, #2599)
    • Fixed incorrect inherited URLs in pom.xml (@Marcono1234, #2351)

    Performance improvements

    Gson maintenance

    GitHub repository

    Other


    Many thanks to @Marcono1234 for drafting these release notes.

    Open source →
    Release notes

    Gson 2.11.0

    Compare

    Choose a tag to compare

    Open source →
  9. 2.10.1 06 Jan 2023
    Release notes

    This is technically a minor release rather than a patch release because there is one small API change: a new JsonObject.isEmpty() method.

    What's Changed: User-Visible Changes

    Site Documentation and Maintenance Changes (these were already visible)

    Other Changes

    New Contributors (thanks!)

    Full Changelog: gson-parent-2.10...gson-parent-2.10.1

    Open source →
    Release notes

    Gson 2.10.1

    Compare

    Choose a tag to compare

    Open source →
  10. 2.10 25 Oct 2022
    Release notes

    Most important changes

    • Support for serializing and deserializing Java records, on Java ≥ 16. (#2201)

    • Add JsonArray.asList and JsonObject.asMap view methods (#2225)

    • Fix TypeAdapterRuntimeTypeWrapper not detecting reflective TreeTypeAdapter and FutureTypeAdapter (#1787)

    • Improve JsonReader.skipValue() (#2062)

    • Perform numeric conversion for primitive numeric type adapters (#2158)

    • Add Gson.fromJson(..., TypeToken) overloads (#1700)

    • Fix changes to GsonBuilder affecting existing Gson instances (#1815)

    • Make JsonElement conversion methods more consistent and fix javadoc (#2178)

    • Throw UnsupportedOperationException when JsonWriter.jsonValue is not supported (#1651)

    • Disallow JsonObject Entry.setValue(null) (#2167)

    • Fix TypeAdapter.toJson throwing AssertionError for custom IOException (#2172)

    • Convert null to JsonNull for JsonArray.set (#2170)

    • Fixed nullSafe usage. (#1555)

    • Validate TypeToken.getParameterized arguments (#2166)

    • Fix #1702: Gson.toJson creates CharSequence which does not implement toString (#1703)

    • Prefer existing adapter for concurrent Gson.getAdapter calls (#2153)

    • Improve ArrayTypeAdapter for Object[] (#1716)

    • Improve AppendableWriter performance (#1706)

    List of all changes

    New Contributors

    Full Changelog: gson-parent-2.9.1...gson-parent-2.10

    Open source →
    Release notes
    • Support for serializing and deserializing Java records, on Java ≥ 16. (https://github.com/google/gson/pull/2201)
    • Add JsonArray.asList and JsonObject.asMap view methods (https://github.com/google/gson/pull/2225)
    • Fix TypeAdapterRuntimeTypeWrapper not detecting reflective TreeTypeAdapter and FutureTypeAdapter (https://github.com/google/gson/pull/1787)
    • Improve JsonReader.skipValue() (https://github.com/google/gson/pull/2062)
    • Perform numeric conversion for primitive numeric type adapters (https://github.com/google/gson/pull/2158)
    • Add Gson.fromJson(..., TypeToken) overloads (https://github.com/google/gson/pull/1700)
    • Fix changes to GsonBuilder affecting existing Gson instances (https://github.com/google/gson/pull/1815)
    • Make JsonElement conversion methods more consistent and fix javadoc (https://github.com/google/gson/pull/2178)
    • Throw UnsupportedOperationException when JsonWriter.jsonValue is not supported (https://github.com/google/gson/pull/1651)
    • Disallow JsonObject Entry.setValue(null) (https://github.com/google/gson/pull/2167)
    • Fix TypeAdapter.toJson throwing AssertionError for custom IOException (https://github.com/google/gson/pull/2172)
    • Convert null to JsonNull for JsonArray.set (https://github.com/google/gson/pull/2170)
    • Fixed nullSafe usage. (https://github.com/google/gson/pull/1555)
    • Validate TypeToken.getParameterized arguments (https://github.com/google/gson/pull/2166)
    • Fix #1702: Gson.toJson creates CharSequence which does not implement toString (https://github.com/google/gson/pull/1703)
    • Prefer existing adapter for concurrent Gson.getAdapter calls (https://github.com/google/gson/pull/2153)
    • Improve ArrayTypeAdapter for Object[] (https://github.com/google/gson/pull/1716)
    • Improve AppendableWriter performance (https://github.com/google/gson/pull/1706)
    Open source →
    Release notes

    Gson 2.10

    Compare

    Choose a tag to compare

    Open source →
  11. 2.9.1 31 Jul 2022
    Release notes
    • Make Object and JsonElement deserialization iterative rather than recursive (https://github.com/google/gson/pull/1912)
    • Added parsing support for enum that has overridden toString() method (https://github.com/google/gson/pull/1950)
    • Removed support for building Gson with Gradle (https://github.com/google/gson/pull/2081)
    • Removed obsolete codegen hierarchy (https://github.com/google/gson/pull/2099)
    • Add support for reflection access filter (https://github.com/google/gson/pull/1905)
    • Improve TypeToken creation validation (https://github.com/google/gson/pull/2072)
    • Add explicit support for float in JsonWriter (https://github.com/google/gson/pull/2130, https://github.com/google/gson/pull/2132)
    • Fail when parsing invalid local date (https://github.com/google/gson/pull/2134)

    Also many small improvements to javadoc.

    Open source →
    Release notes

    Gson 2.9.1

    Compare

    Choose a tag to compare

    Open source →
  12. 2.9.0 11 Feb 2022
    Release notes

    The minimum supported Java version changes from 6 to 7.

    • Change target Java version to 7 (https://github.com/google/gson/pull/2043)
    • Put module-info.class into Multi-Release JAR folder (https://github.com/google/gson/pull/2013)
    • Improve error message when abstract class cannot be constructed (https://github.com/google/gson/pull/1814)
    • Support EnumMap deserialization (https://github.com/google/gson/pull/2071)
    • Add LazilyParsedNumber default adapter (https://github.com/google/gson/pull/2060)
    • Fix JsonReader.hasNext() returning true at end of document (https://github.com/google/gson/pull/2061)
    • Remove Gradle build support. Build script was outdated and not actively maintained anymore (https://github.com/google/gson/pull/2063)
    • Add GsonBuilder.disableJdkUnsafe() (https://github.com/google/gson/pull/1904)
    • Add UPPER_CASE_WITH_UNDERSCORES in FieldNamingPolicy (https://github.com/google/gson/pull/2024)
    • Fix failing to serialize Collection or Map with inaccessible constructor (https://github.com/google/gson/pull/1902)
    • Improve TreeTypeAdapter thread-safety (https://github.com/google/gson/pull/1976)
    • Fix Gson.newJsonWriter ignoring lenient and HTML-safe setting (https://github.com/google/gson/pull/1989)
    • Delete unused LinkedHashTreeMap (https://github.com/google/gson/pull/1992)
    • Make default adapters stricter; improve exception messages (https://github.com/google/gson/pull/2000)
    • Fix FieldNamingPolicy.upperCaseFirstLetter uppercasing non-letter (https://github.com/google/gson/pull/2004)
    Open source →
  13. 2.8.9 29 Oct 2021
    Release notes
    • Make OSGi bundle's dependency on sun.misc optional (https://github.com/google/gson/pull/1993).
    • Deprecate Gson.excluder() exposing internal Excluder class (https://github.com/google/gson/pull/1986).
    • Prevent Java deserialization of internal classes (https://github.com/google/gson/pull/1991).
    • Improve number strategy implementation (https://github.com/google/gson/pull/1987).
    • Fix LongSerializationPolicy null handling being inconsistent with Gson (https://github.com/google/gson/pull/1990).
    • Support arbitrary Number implementation for Object and Number deserialization (https://github.com/google/gson/pull/1290).
    • Bump proguard-maven-plugin from 2.4.0 to 2.5.1 (https://github.com/google/gson/pull/1980).
    • Don't exclude static local classes (https://github.com/google/gson/pull/1969).
    • Fix RuntimeTypeAdapterFactory depending on internal Streams class (https://github.com/google/gson/pull/1959).
    • Improve Maven build (https://github.com/google/gson/pull/1964).
    • Make dependency on java.sql optional (https://github.com/google/gson/pull/1707).
    Open source →
  14. 2.8.8 20 Aug 2021
    Release notes
    • Fixed issue with recursive types (https://github.com/google/gson/issues/1390).
    • Better behavior with Java 9+ and Unsafe if there is a security manager (https://github.com/google/gson/pull/1712).
    • EnumTypeAdapter now works better when ProGuard has obfuscated enum fields (https://github.com/google/gson/pull/1495).
    Open source →
  15. 2.8.7 24 May 2021
    Release notes
    • Fixed ISO8601UtilsTest failing on systems with UTC+X.
    • Improved javadoc for JsonStreamParser.
    • Updated proguard.cfg (https://github.com/google/gson/pull/1693).
    • Fixed IllegalStateException in JsonTreeWriter (https://github.com/google/gson/issues/1592).
    • Added JsonArray.isEmpty() (https://github.com/google/gson/pull/1640).
    • Added new test cases (https://github.com/google/gson/pull/1638).
    • Fixed OSGi metadata generation to work on JavaSE < 9 (https://github.com/google/gson/pull/1603).
    Open source →
  16. 2.8.6 04 Oct 2019
    Release notes

    2019-10-04 GitHub Diff

    • Added static methods JsonParser.parseString and JsonParser.parseReader and deprecated instance method JsonParser.parse
    • Java 9 module-info support
    Open source →
  17. 2.8.5 22 May 2018
    Release notes

    2018-05-21 GitHub Diff

    • Print Gson version while throwing AssertionError and IllegalArgumentException
    • Moved utils.VersionUtils class to internal.JavaVersion. This is a potential backward incompatible change from 2.8.4
    • Fixed issue https://github.com/google/gson/issues/1310 by supporting Debian Java 9
    Open source →
  18. 2.8.4 01 May 2018
    Release notes

    2018-05-01 GitHub Diff

    • Added a new FieldNamingPolicy, LOWER_CASE_WITH_DOTS that maps JSON name someFieldName to some.field.name
    • Fixed issue https://github.com/google/gson/issues/1305 by removing compile/runtime dependency on sun.misc.Unsafe
    Open source →
  19. 2.8.3 27 Apr 2018
    Release notes

    2018-04-27 GitHub Diff

    • Added a new API, GsonBuilder.newBuilder() that clones the current builder
    • Preserving DateFormatter behavior on JDK 9
    • Numerous other bugfixes
    Open source →
  20. 2.8.2 20 Sep 2017
    Release notes

    2017-09-19 GitHub Diff

    • Introduced a new API, JsonElement.deepCopy()
    • Numerous other bugfixes
    Open source →
  21. 2.8.1 31 May 2017
    Release notes

    2017-05-30 GitHub Diff

    • New: JsonObject.keySet()
    • @JsonAdapter annotation can now use JsonSerializer and JsonDeserializer as well.
    Open source →
  22. 2.8.0 27 Oct 2016

    Nothing published for this version

  23. 2.7 14 Jun 2016
    Release notes

    2016-06-14 GitHub Diff

    • Added support for JsonSerializer/JsonDeserializer in @JsonAdapter annotation
    • Exposing Gson properties excluder(), fieldNamingStrategy(), serializeNulls(), htmlSafe()
    • Added JsonObject.size() method
    • Added JsonWriter.value(Boolean value) method
    • Using ArrayDeque, ConcurrentHashMap, and other JDK 1.6 features
    • Better error reporting
    • Plenty of other bug fixes
    Open source →
  24. 2.6.2 27 Feb 2016
    Release notes

    2016-02-26 GitHub Diff

    • Fixed an NPE bug with @JsonAdapter annotation
    • Added back OSGI manifest
    • Some documentation typo fixes
    Open source →
  25. 2.6.1 12 Feb 2016
    Release notes

    2016-02-11 GitHub Diff

    • Fix: The 2.6 release targeted Java 1.7, but we intend to target Java 1.6. The 2.6.1 release is identical to 2.6, but it targets Java 1.6.
    Open source →
  26. 2.6 11 Feb 2016
    Release notes

    2016-02-11 GitHub Diff

    • Permit timezones without minutes in the default date adapter.
    • Update reader and writer for RFC 7159. This means that strings, numbers, booleans and null may be top-level values in JSON documents, even if the reader is strict.
    • New setLenient() method on GsonBuilder. This setting impacts the new factory method Gson.newJsonReader().
    • Adapters discovered with @JsonAdapter are now null safe by default.
    Open source →
  27. 2.5 24 Nov 2015
    Release notes

    2015-11-24 GitHub Diff

    • Updated minimum JDK version to 1.6
    • Improved Date Deserialization by accepting many date formats
    • Added support for java.util.Currency, AtomicLong, AtomicLongArray, AtomicInteger, AtomicIntegerArray, AtomicBoolean. This change is backward-incompatible because the earlier version of Gson used the default serialization which wasn't intuitive. We hope that these classes are not used enough to actually cause problems in the field.
    • Improved debugging information when some exceptions are thrown
    Open source →
  28. 2.4 04 Oct 2015
    Release notes

    2015-10-04

    • Drop IOException from TypeAdapter.toJson(). This is a binary-compatible change, but may cause compiler errors where IOExceptions are being caught but no longer thrown. The correct fix for this problem is to remove the unnecessary catch clause.
    • New: Gson.newJsonWriter method returns configured JsonWriter instances.
    • New: @SerializedName now works with [AutoValue’s][autovalue] abstract property methods.
    • New: @SerializedName permits alternate names when deserializing.
    • New: JsonWriter#jsonValue writes raw JSON values.
    • New: APIs to add primitives directly to JsonArray instances.
    • New: ISO 8601 date type adapter. Find this in extras.
    • Fix: FieldNamingPolicy now works properly when running on a device with a Turkish locale. [autovalue]: https://github.com/google/auto/tree/main/value
    Open source →
  29. 2.3.1 20 Nov 2014
    Release notes

    2014-11-20

    • Added support to serialize objects with self-referential fields. The self-referential field is set to null in JSON. Previous version of Gson threw a StackOverflowException on encountering any self-referential fields.
      • The most visible impact of this is that Gson can now serialize Throwable (Exception and Error)
    • Added support for @JsonAdapter annotation on enums which are user defined types
    • Fixed bug in getPath() with array of objects and arrays of arrays
    • Other smaller bug fixes
    Open source →
  30. 2.3 11 Aug 2014
    Release notes

    2014-08-11

    • The new @JsonAdapter annotation to specify a Json TypeAdapter for a class field
    • JsonPath support: JsonReader.getPath() method returns the JsonPath expression
    • New public methods in JsonArray (similar to the java.util.List): contains(JsonElement), remove(JsonElement), remove(int index), set(int index, JsonElement element)
    • Many other smaller bug fixes
    Open source →
  31. 2.2.4 13 May 2013
    Release notes

    2013-05-13

    • Fix internal map (LinkedHashTreeMap) hashing bug.
    • Bug fix (Issue 511)
    Open source →
  32. 2.2.3 12 Apr 2013
    Release notes

    2013-04-12

    • Fixes for possible DoS attack due to poor String hashing
    Open source →
  33. 2.2.2 03 Jul 2012
    Release notes

    2012-07-02

    • Gson now allows a user to override default type adapters for Primitives and Strings. This behavior was allowed in earlier versions of Gson but was prohibited started Gson 2.0. We decided to allow it again: This enables a user to parse 1/0 as boolean values for compatibility with iOS JSON libraries.
    • (Incompatible behavior change in JsonParser): In the past, if JsonParser encountered a stream that terminated prematurely, it returned JsonNull. This behavior wasn't correct because the stream had invalid JSON, not a null. JsonParser is now changed to throw JsonSyntaxException in this case. Note that if JsonParser (or Gson) encounter an empty stream, they still return JsonNull.
    Open source →
  34. 2.2.1 11 May 2012
    Release notes

    2012-05-05

    • Very minor fixes
    Open source →
  35. 2.2 06 May 2012
    Release notes

    2012-05-05

    • Added getDelegateAdapter in Gson class
    • Fixed a security bug related to denial of service attack with Java HashMap String collisions.
    Open source →
  36. 2.1 31 Dec 2011
    Release notes

    2011-12-30 (Targeted Dec 31, 2011)

    • Support for user-defined streaming type adapters
    • continued performance enhancements
    • Dropped support for type hierarchy instance creators. We don't expect this to be a problem. We'll also detect fewer errors where multiple type adapters can serialize the same type. With APIs like getNextTypeAdapter, this might actually be an improvement!
    Open source →
  37. 2.0 13 Nov 2011
    Release notes

    2011-11-13

    Faster

    • Previous versions first parsed complete document into a DOM-style model (JsonObject or JsonArray) and then bound data against that. Gson 2 does data binding directly from the stream parser.

    More Predictable

    • Objects are serialized and deserialized in the same way, regardless of where they occur in the object graph.

    Changes to watch out for

    • Gson 1.7 would serialize top-level nulls as "". 2.0 serializes them as "null".

      String json = gson.toJson(null, Foo.class);
      1.7: json == ""
      2.0: json == "null"
      
    • Gson 1.7 permitted duplicate map keys. 2.0 forbids them.

      String json = "{'a':1,'a':2}";
      Map<String, Integer> map = gson.fromJson(json, mapType);
      1.7: map == {a=2}
      2.0: JsonSyntaxException thrown
      
    • Gson 1.7 won’t serialize subclass fields in collection elements. 2.0 adds this extra information.

      List<Point2d> points = new ArrayList<Point2d>();
      points.add(new Point3d(1, 2, 3));
      String json = gson.toJson(points,
          new TypeToken<List<Point2d>>() {}.getType());
      1.7: json == "[{'x':1,'y':2}]"
      2.0: json == "[{'x':1,'y':2,'z':3}]"
      
    • Gson 1.7 binds single-element arrays as their contents. 2.0 doesn’t.

      Integer i = gson.fromJson("[42]", Integer.class);
      1.7: i == 42
      2.0: JsonSyntaxException thrown
      

    Other changes to be aware of

    • Gson 2.0 doesn’t support type adapters for primitive types.
    • Gson 1.7 uses arbitrary precision for primitive type conversion (so -122.08e-2132 != 0). Gson 2.0 uses double precision (so -122.08e-2132 == 0).
    • Gson 1.7 sets subclass fields when an InstanceCreator returns a subclass when the value is a field of another object. Gson 2.0 sets fields of the requested type only.
    • Gson 1.7 versioning never skips the top-level object. Gson 2.0 versioning applies to all objects.
    • Gson 1.7 truncates oversized large integers. Gson 2.0 fails on them.
    • Gson 2.0 permits integers to have .0 fractions like "1.0".
    • Gson 1.7 throws IllegalStateException on circular references. Gson 2.0 lets the runtime throw a StackOverflowError.
    Open source →
  38. 1.7.2 30 Sep 2011
    Release notes

    2011-09-30 (Unplanned release)

    • Fixed a threading issue in FieldAttributes (Issue 354)
    Open source →
  39. 1.7.1 13 Apr 2011
    Release notes

    2011-04-13 (Unplanned release)

    • Fixed Gson jars in Maven Central repository
    • Removed assembly-descriptor.xml and maven pom.xml/pom.properties files from Gson binary jar. This also ensures that jarjar can be run correctly on Gson.
    Open source →
  40. 1.7 12 Apr 2011
    Release notes

    2011-04-12 (Targeted: Jan 2011)

    • No need to define no-args constructors for classes serialized with Gson
    • Ability to register a hierarchical type adapter
    • Support for serialization and deserialization of maps with complex keys
    • Serialization and deserialization specific exclusion strategies
    • Allow concrete data structure fields without type adapters
    • Fixes "type" management (i.e. Wildcards, etc.)
    • Major performance enhancements by reducing the need for Java reflection See detailed announcement at this thread in the Gson Google Group.
    Open source →
  41. 1.6 15 Mar 2011
    Release notes

    2010-11-24 (Targeted: Oct, 2010)

    • New stream parser APIs
    • New parser that improves parsing performance significantly
    Open source →
  42. 1.5 14 Mar 2011
    Release notes

    2010-08-19 (Target Date: Aug 18, 2010)

    • Added UPPER_CAMEL_CASE_WITH_SPACES naming policy
    • Added SQL date and time support
    • A number of performance improvements: Using caching of field annotations for speeding up reflection, replacing recursive calls in the parser with a for loop.
    Open source →
  43. 1.4 09 Oct 2009
    Release notes

    2009_10_09

    • JsonStreamParser: A streaming parser API class to deserialize multiple JSON objects on a stream (such as a pipelined HTTP response)
    • Raised the deserialization limit for byte and object arrays and collection to over 11MB from 80KB. See issue 96.
    • While serializing, Gson now uses the actual type of a field. This allows serialization of base-class references holding sub-classes to the JSON for the sub-class. It also allows serialization of raw collections. See Issue 155, 156.
    • Added a Gson.toJsonTree() method that serializes a Java object to a tree of JsonElements. See issue 110.
    • Added a Gson.fromJson(JsonElement) method that deserializes from a Json parse tree.
    • Updated Expose annotation to contain parameters serialize and deserialize to control whether a field gets serialized or deserialized. See issue 146.
    • Added a new naming policy LOWER_CASE_WITH_DASHES
    • Default date type adapter is now thread-safe. See Issue 162.
    • JsonElement.toString() now outputs valid JSON after escaping characters properly. See issue 154.
    • JsonPrimitive.equals() now returns true for two numbers if their values are equal. All integral types (long, int, short, byte, BigDecimal, Long, Integer, Short, Byte) are treated equivalent for comparison. Similarly, floating point types (double, float, BigDecimal, Double, Float) are treated equivalent as well. See issue 147.
    • Fixed bugs in pretty printing. See issue 153.
    • If a field causes circular reference error, Gson lists the field name instead of the object value. See issue 118.
    • Gson now serializes a list with null elements correctly. See issue 117.
    • Fixed issue 121, 123, 126.
    • Support user defined exclusion strategies (Feature Request 138).
    Open source →
  44. 1.1 10 Aug 2008
    Release notes

    2008-07-01 (Target Date Thursday, July 3, 2008)

    • Includes fixes for Issue 9, Issue 16, Issue 18
    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive