开发者

Jackson Json parser does not parse strictly. Solution?

开发者 https://www.devze.com 2023-03-23 05:59 出处:网络
The following string is an invalid JSON string according to http://www.json.org/ \"billPeriod\":{\"from\":\"2011-6-1\",\"to\":\"2011-6-28\"}}

The following string is an invalid JSON string according to http://www.json.org/

"billPeriod":{"from":"2011-6-1","to":"2011-6-28"}}

It is missing a closing brace at the start.

However, when I pass this through the Jackson Json parser, it returns a JsonMappingException rather开发者_开发问答 than a JsonParseException.

ObjectMapper mapper = new ObjectMapper();
String input = "\"billPeriod\":{\"from\":\"2011-6-1\",\"to\":\"2011-6-28\"}}"
mapper.readValue(input, clazz.class);

Can anyone help? I've looked but can't find a variable setting to increase the "strictness" of the parsing.

Thanks Dan

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号