[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]
运行了你这个IndexField,没有问题的。
最好把json相关的bean都贴出来,像我上次回复你的那样,你那个json也就3个bean:
IndexField、Index、Indexs(按照你的写法)
No suitable constructor found for type [simple type, class com.abc.search.vo.IndexField], 把com.abc.search.vo.IndexField的代码贴出来
IndexField 有空参构造器吗