Open Wizzercn opened 7 years ago
{
"key":[
{
"a":"aaaa1",
"b":"bbbb1",
},
{
"a":"aaaa2",
"b":"bbbb2",
}]
}
@wendal 亲,数据接口是电信的,我改不了人家的接口啊,它就是这样BT的啊
JSON里面带重复key???
@wendal 准确的说是xml:
<root>
<web:NEW_DATA_TICKET_QRsp>
<number>1064901037***</number>
<TOTAL_BYTES_CNT>33.97MB</TOTAL_BYTES_CNT>
<DURATION_CNT_CH>479小时53分钟45秒</DURATION_CNT_CH>
<CHARGE_CNT_CH>0(元)</CHARGE_CNT_CH>
<NEW_DATA_TICKET_QRlist>
<TICKET_NUMBER>1</TICKET_NUMBER>
<TICKET_TYPE>江苏南京</TICKET_TYPE>
<SERVICE_TYPE>3G(EVDO)</SERVICE_TYPE>
<START_TIME>2014-10-01 03:43</START_TIME>
<DURATION_CH>6小时2秒</DURATION_CH>
<TICKET_CHARGE_CH>0.00</TICKET_CHARGE_CH>
<BYTES_CNT>267KB</BYTES_CNT>
<CCG_PRODUCT_NAME />
</NEW_DATA_TICKET_QRlist>
<NEW_DATA_TICKET_QRlist>
<TICKET_NUMBER>2</TICKET_NUMBER>
<TICKET_TYPE>江苏南京</TICKET_TYPE>
<SERVICE_TYPE>3G(EVDO)</SERVICE_TYPE>
<START_TIME>2014-10-01 09:43</START_TIME>
<DURATION_CH>6小时</DURATION_CH>
<TICKET_CHARGE_CH>0.00</TICKET_CHARGE_CH>
<BYTES_CNT>290KB</BYTES_CNT>
<CCG_PRODUCT_NAME />
</NEW_DATA_TICKET_QRlist>
<NEW_DATA_TICKET_QRlist>
<TICKET_NUMBER>3</TICKET_NUMBER>
<TICKET_TYPE>江苏南京</TICKET_TYPE>
<SERVICE_TYPE>3G(EVDO)</SERVICE_TYPE>
<START_TIME>2014-10-01 15:43</START_TIME>
<DURATION_CH>6小时</DURATION_CH>
<TICKET_CHARGE_CH>0.00</TICKET_CHARGE_CH>
<BYTES_CNT>296KB</BYTES_CNT>
<CCG_PRODUCT_NAME />
</NEW_DATA_TICKET_QRlist>
<IRESULT>0</IRESULT>
<SMSG>成功</SMSG>
</web:NEW_DATA_TICKET_QRsp>
</root>
xpath
NutMap.getList会自动封装的
问题是,有一个结果的时候封装成了对象,多个的时候变成list,我是想不管一个或多个都是list
哦,这是个问题
问题又来了, nutz如何知道某个属性是否应该是list呢...
Lang.map2obj的里面做些判断??
List<NutMap> cumulRspList = new ArrayList<>();
Object v = web.get("CumulRspList");
if (v instanceof Collection) {
cumulRspList = web.getList("CumulRspList", NutMap.class);
}
if (v instanceof NutMap) {
cumulRspList.add((NutMap) v);
}
暂时是这样解决的