typeToken
removes generic type parameter wildcards. This means thattypeToken<List<Something>>
will now returnList<Something>
instead ofList<? extends Something>
.- Added the
byNullable*
functions to delegate to nullable values inside aJsonObject
orJsonArray
(thanks to @eygraber Eliezer Graber). - Added the possibility to define a default value to the delegate
by*
methods (thanks to @eygraber Eliezer Graber). - Added the
addProperty
andaddPropertyIfNotNull
methods toJsonObject
(thanks to @ColinHebert Colin Hebert). - Added the ability to add a
JsonSerializer
andJsonDeserializer
withregisterTypeAdapter
(thanks to @ColinHebert Colin Hebert). - Gson
2.8.0
, see changelog. - Kotlin
1.0.6
- Gradle
3.3
typeToken
is more permissive with generic parameters. It tries to infer generic wildcards.- Kotlin
1.0.3
- Gradle
2.14.1
. - Spek
1.0.25
.
- In a
JsonSerializer
, usingit.context.serialize
now serializes according to the object real type (at runtime), which is consistent withGson.toJson
. Serializing according to the compile time type is possible withit.context.typedSerialize
, which is consistent withGson.typedToJson
. - Gson
2.7
, see changelog. - Kotlin
1.0.2-1
jsonArray
andjsonObject
functions are now usable withIterable
andSequence
.- Gradle
2.13
.
- Kotlin
1.0.2
. - Spek
1.0.9
.
- Kotlin
1.0.1
. - Gson
2.6.2
. - Spek
1.0.0
. - Added
read
andwrite
toregisterTypeAdapter
andregisterTypeHierarchyAdapter
. - Added
registerNullableTypeAdapter
abdregisterNullableTypeHierarchyAdapter
. - Renamed
typeToken
togsonTypeToken
andregistrationTypeToken
totypeToken
. That means thattypeToken<List<*>>
will now return aClass
. If still want aParametrizedType
corresponding to java'sList<? extends Object>
, you should usegsonTypeToken
.
- Kotlin
1.0.0
. - gson
2.6.1
.
- Correcting #11:
typeToken
is back to its classic gson semantic. registrationTypeToken
has the semantic of the previoustypeToken
.
- Kotlin
1.0.0-beta-1036
. - Gson
2.5
. - Introducing
typedToJson
. typeToken
now returns aClass
instead of aParameterizedType
when for non specialized generic types (such asList<*>*
).- New syntax for
registerTypeAdapter
andregisterTypeHierarchyAdapter
for declaring type adapters (serializers and deserializers).