rharter / auto-gson
Category: Other
Minimum SDK Level: Unknown :(


View in Github Github project information
Starred: 0
Forks: 0
Watchers: 0
Open Issues: 0

Snapshot pictures

No snapshot for this library yet.



An extension for Google's AutoValue that creates a simple Gson Serializer and Deserializer for each AutoValue annotated object.

Note: This is a very early version that won't work with the released AutoValue until a PR has been merged.


Simply include AutoGson in your project and add the generated Serializer and Deserializer as a TypeAdapter. You can also annotate your properties using @SerializedName to define an alternate name for de/serialization.

@AutoValue public abstract class Foo {
  abstract String bar();
  @SerializedName("Baz") abstract String baz();

final Gson gson = new GsonBuilder()
  .registerTypeAdapterFactory(Foo.class, AutoValue_Foo.typeAdapterFactory())

Now build your project and de/serialize your Foo.


See also