JSON: Deserializing DateTime field throws IllegalArgumentException

123 views
Skip to first unread message

Chris Vaughan

unread,
Jan 29, 2014, 11:32:13 AM1/29/14
to google-http...@googlegroups.com
Should this work?

JSON:
{
...
"start_date": "2013-10-03T11:12:13.000+0100"
... 
}

POJO:
public class ConfigResponse {
...
@Key("start_date")
public com.google.api.client.util.DateTime date;
... 
}

To deserialize I'm doing thisl:

new JacksonFactory().createJsonParser(json).parse(ConfigResponse.class)


I'm getting an IllegalArgumentException:
java.lang.IllegalArgumentException: key start_date
at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:871)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:374)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:328)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:304)
at com.laterooms.core.util.JsonUtils.parseContent(JsonUtils.java:37)
...

I'm using lib 1.16, but the release notes for 1.17 suggest that if this is a bug, it hasn't been fixed.
Reply all
Reply to author
Forward
0 new messages