json.org例子

 

JSONObject jsonObj = new JSONObject(goodsListJson);

JSONArray array = jsonObj.getJSONArray("goods_list");

if(null!=array){

for(int i=0;i<array.length();i++){

OrderGoodsDO goods = new OrderGoodsDO();

JSONObject obj = new JSONObject(array.get(i).toString());

if(obj.has("outer_id")){

goods.setAuctionCode(obj.getString("outer_id"));

}

goods.setGoodsName(obj.getString("goods_name"));

goods.setSinglePrice(obj.getDouble("single_price"));

goods.setGoodsQuantity(obj.getLong("goods_quantity"));

goodsList.add(goods);

}

}

 

你可能感兴趣的:(list,null)