A set of GSON serialiser/deserialisers for dealing with Java 8 java.time
entities. Wherever possible, ISO 8601 string representations are used.
<dependency>
<groupId>com.fatboyindustrial.gson-javatime-serialisers</groupId>
<artifactId>gson-javatime-serialisers</artifactId>
<version>1.1.2</version>
</dependency>
final Gson gson = Converters.registerOffsetDateTime(new GsonBuilder()).create();
final OffsetDateTime original = OffsetDateTime.now();
final String json = gson.toJson(original);
final OffsetDateTime reconstituted = gson.fromJson(json, OffsetDateTime.class);
Unrelated to gson-javatime-serialisers
itself, but if you're working with Java 8 time, you may be interested in spencerwi/hamcrest-jdk8-time