猴王牌 2013-04-27 16:44 采纳率: 50%
浏览 293
已采纳

JsonMappingException

[code="java"]
ObjectMapper mapper = new ObjectMapper();
JsonNode jsonNode = mapper.readTree(json);
JsonNode jn = jsonNode.get("indexs");
System.out.println(jn.toString());

    Indexs p = mapper.readValue(json, Indexs.class); 

[/code]
[code="java"]
org.codehaus.jackson.map.JsonMappingException: No suitable constructor found for type [simple type, class com.abc.search.vo.IndexField]: can not instantiate from JSON object (need to add/enable type information?)
at Source: java.io.StringReader@33a626ac; line: 1, column: 70
[/code]

详细问题:[url]http://www.iteye.com/problems/94592[/url]

  • 写回答

3条回答 默认 最新

  • Dead_Knight 2013-04-27 17:53
    关注

    运行了你这个IndexField,没有问题的。
    最好把json相关的bean都贴出来,像我上次回复你的那样,你那个json也就3个bean:
    IndexField、Index、Indexs(按照你的写法)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?