このようなjson
{
"resultCode": "0000",
"resultMsg": "",
"pageCount": "6",
"curPage": "1",
"infoItems": [
{
"sID": "268",
"location": "222",
"unit": "",
"time": "2012-11-02 17:51:46",
"longitude": "111",
"latitude": "222",
"reason": "some",
"dealContent": ""
},
{
"sID": "267",
"location": "fgg",
"unit": "yyg",
"time": "2012-11-02 17:49:14",
"longitude": "111",
"latitude": "222",
"reason": "some",
"dealContent": ""
}
]
}
どうすればJavaクラスにデコードできますか?
私は次のようなクラスを書きます
public class UploadedInfoObjEx {
public String resultCode;
public String resultMsg;
public String pageCount;
public String curPage;
public Items[] infoItems;
public class Items {
private String sID;
private String location;
private String unit;
private String longitude;
private String latitude;
private String reason;
private String time;
private String dealContent;
}
}
そしてjsonを読む
ObjectMapper mapper = new ObjectMapper();
UploadedInfoObjEx uploadedInfoObjEx = mapper.readValue(jsonString, UploadedInfoObjEx.class);
エラーは
org.codehaus.jackson.map.JsonMappingException: No suitable constructor found for type [simple type, class com.rayboot.wl.object.UploadedInfoObjEx$Items]: can not instantiate from JSON object (need to add/enable type information?)
[ソース:java.io.StringReader@4150c480; 行:1、列:81](参照チェーンを介して:com.rayboot.wl.object.UploadedInfoObjEx ["infoItems"])
誰かが私を助けることができますか?ありがとう