像这样:
String json = ""\/Date(736032869080)\/"";Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new NetDateTimeAdapter()).create();System.out.println("Date=" + gson.fromJson(json, Date.class));class NetDateTimeAdapter extends TypeAdapter<Date> { @Override public Date read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { reader.nextNull(); return null; } Date result = null; String str = reader.nextString(); str = str.replaceAll("[^0-9]", ""); if (!TextUtils.isEmpty(str)) { try { result = new Date(Long.parseLong(str)); } catch (NumberFormatException e) { } } return result; } @Override public void write(JsonWriter writer, Date value) throws IOException { // Nah.. }}或改用此示例,并遵循“使用WCF Microsoft JSON日期处理”一章。



