JsonオブジェクトをDateを持つJavaオブジェクトにバインドする必要があります。私のJsonの日付形式は次のとおりです。
2013-01-04T10:50:26 + 0000
そして、私は次のようにGsonBulderを使用しています。
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").create();
しかし、私は次の例外を取得しています:
The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
com.google.gson.JsonSyntaxException: 2013-01-04T10:50:26+0000
at com.google.gson.internal.bind.DateTypeAdapter.deserializeToDate(DateTypeAdapter.java:81)
.....
Caused by: java.text.ParseException: Unparseable date: "2013-01-04T10:50:26+0000"
at java.text.DateFormat.parse(DateFormat.java:337)
at com.google.gson.internal.bind.DateTypeAdapter.deserializeToDate(DateTypeAdapter.java:79)
このリクエストをGsonで読み込もうとしています。
https://graph.facebook.com/me?fields=id,username,email,link,updated_time&access_token=accessToken
そして、応答は
{"id":"12345","username":"myusername","email":"myemail\u0040yahoo.it","link":"http:\/\/www.facebook.com\/mysusername","updated_time":"2013-01-04T10:50:26+0000"}