I\'m using GSON to serialise some object graphs to JSON. These objects graphs use Joda Time entities (DateTime
, LocalTime
etc).
The top Go
I've decided to roll my own open source one - you can find it here:
https://github.com/gkopff/gson-jodatime-serialisers
Here's the Maven details (check central for the latest version):
com.fatboyindustrial.gson-jodatime-serialisers
gson-jodatime-serialisers
1.6.0
And here's a quick example of how you drive it:
Gson gson = Converters.registerDateTime(new GsonBuilder()).create();
SomeContainerObject original = new SomeContainerObject(new DateTime());
String json = gson.toJson(original);
SomeContainerObject reconstituted = gson.fromJson(json, SomeContainerObject.class);