-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Closed
Description
This my Gson code:
protected Object fromJson(String json, Type t) {
try {
Gson g = new Gson();
Object o = g.fromJson(json, t);
return o;
} catch (Exception e) {
logger.error(e.getMessage(), e);
return null;
}
}
I have an object which have a 2 Timestamp fields and I want to consume a json response using Gson but I have got an Invalid time zone indicator ' '.But this is not always happening. I don't know why.
So this is out put :
Caused by: java.text.ParseException: Failed to parse date ["2018-04-12 18:38:02']: Invalid time zone indicator ' '
at com.google.gson.internal.bind.util.ISO8601Utils.parse(ISO8601Utils.java:274) ~[gson-2.8.2.jar!/:?]
at com.google.gson.internal.bind.DateTypeAdapter.deserializeToDate(DateTypeAdapter.java:72) ~[gson-2.8.2.jar!/:?]
... 106 more
Caused by: java.lang.IndexOutOfBoundsException: Invalid time zone indicator ' '
at com.google.gson.internal.bind.util.ISO8601Utils.parse(ISO8601Utils.java:245) ~[gson-2.8.2.jar!/:?]
at com.google.gson.internal.bind.DateTypeAdapter.deserializeToDate(DateTypeAdapter.java:72) ~[gson-2.8.2.jar!/:?]
... 106 more
This my Gson data:
[
{
"id": 2267,
"code": "2100130106335294543080001",
"name": "ly123",
"servicetype": "VOD",
"showname": "ly123",
"type1": 1,
"pictureurl1": "",
"pictureurl2": "",
"status": 1,
"isdelete": false,
"checkstatus1": 10,
"createtime": "2018-04-12 18:38:02",
"updatetime": "2018-04-12 18:38:15",
"description": "",
"sgs": [],
"sgCodes": [],
"isPool": false
}
]
Metadata
Metadata
Assignees
Labels
No labels