I am working on something at the moment where I have a service written in .net which serves json created using the Json.Net library. This is then consumed by a client app written in Java which uses the Gson library to deserialize that json into Java classes. This was all working fine except for dates which caused parse errors in Gson.
The solution I am using is:
use ISO time format when serializing with Json.Net
string json = JsonConvert.SerializeObject(entry, new IsoDateTimeConverter());
When Deserializing with Gson set the date format as follows:
GsonBuilder b = new GsonBuilder(); b.setDateFormat("yyyy-MM-dd'T'HH:mm:ss"); Gson gson = b.create(); gson.fromJson(json, MyObjectType.class);