All Versions
Latest Version
Avg Release Cycle
133 days
Latest Release

Changelog History
Page 3

  • v2.2.4 Changes


    • Fix internal map (LinkedHashTreeMap) hashing bug.
    • Bug fix (Issue 511)
  • v2.2.3 Changes


    • Fixes for possible DoS attack due to poor String hashing
  • v2.2.2 Changes


    • 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.
  • v2.2.1 Changes


    • Very minor fixes
  • v2.2 Changes


    • Added getDelegateAdapter in Gson class
    • Fixed a security bug related to denial of service attack with Java HashMap String collisions.
  • v2.1 Changes

    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!
  • v2.0 Changes



    • 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.
  • v1.7.2 Changes

    2011-09-30 (Unplanned release)

    • Fixed a threading issue in FieldAttributes (Issue 354)
  • v1.7.1 Changes

    2011-04-13 (Unplanned release)

    • Fixed Gson jars in Maven Central repository
    • Removed assembly-descriptor.xml and maven pom.xml/ files from Gson binary jar. This also ensures that jarjar can be run correctly on Gson.
  • v1.7 Changes

    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.