Я использую Gson для преобразования json в класс Java ... Тип firstLogin: java.util.Date
public static void main(String[] args) {
String lineString="{\"email\":\"sadas\",\"faith\":121,\"qq\":211,\"account\":2412,\"userName\":\"asda\",\"firstLogin\":1321362590000,\"uid\":1}";
Gson gson=new Gson();
User user=gson.fromJson(lineString, User.class);
System.out.println(user.getFirstLogin());
}
Исключение:
Exception in thread "main" com.google.gson.JsonSyntaxException: 1321362590000
at com.google.gson.internal.bind.DateTypeAdapter.deserializeToDate(DateTypeAdapter.java:78)
at com.google.gson.internal.bind.DateTypeAdapter.read(DateTypeAdapter.java:63)
at com.google.gson.internal.bind.DateTypeAdapter.read(DateTypeAdapter.java:38)
at com.google.gson.internal.bind.TypeAdapters$19$1.read(TypeAdapters.java:462)
at com.google.gson.internal.bind.TypeAdapters$19$1.read(TypeAdapters.java:466)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:86)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:170)
at com.google.gson.Gson.fromJson(Gson.java:720)
at com.google.gson.Gson.fromJson(Gson.java:686)
at com.google.gson.Gson.fromJson(Gson.java:636)
at com.google.gson.Gson.fromJson(Gson.java:608)
at gsontest.GsonTest.main(GsonTest.java:22)
Caused by: java.text.ParseException: Unparseable date: "1321362590000"
at java.text.DateFormat.parse(DateFormat.java:357)
at com.google.gson.internal.bind.DateTypeAdapter.deserializeToDate(DateTypeAdapter.java:76)
... 11 more
Java Result: 1
как исправитьпроблема ... спасибо