// 转换成object
JSONObject jo = JSON.parseObject(result);
// 获取object中returnAddress字段;
jo.getString("returnAddress");
2 format2
JSONArray detail = JSON.parseArray(result);
for (int i=0; i<detail.size();i++){
if(detail.get(i)!=null||!detail.get(i).equals("")){
JSONArray detailChild =detail.getJSONArray(i);
if(detailChild.getInteger(1)>Integer.valueOf(ship.get("shiptime").toString())){
ship.put("shiptime",detailChild.getInteger(1));
ship.put("desc",detailChild.getString(0));
}
}
}
3 JSON转Bean
JSONobject=>javaBean
JSONObject contentChild = contentsArray.getJSONObject(i);
QCCustomerScore.CustomerCore customerCore = JSON
.toJavaObject(contentChild, QCCustomerScore.CustomerCore.class);
String转javaBean
参考
- https://blog.csdn.net/a18827547638/article/details/80777366