public static CourierListItemBean parseBringSearchJson(String jsonData) { CourierListItemBean item = new CourierListItemBean(); try { JSONObject jsonObject = new JSONObject(jsonData); JSONObject data = new JSONObject(jsonObject.getString("data")); item.setTel(data.getString("tel")); item.setExpressNum(data.getString("expressNum")); item.setExpressCompany(data.getString("companyName")); item.setUserID(data.getString("userID")); item.setExpressAddress(data.getString("expressAddress")); item.setReceiver(data.getString("receiver")); item.setExpressName(data.getString("expressName")); item.setExpressGetAddress(data.getString("expressGetAddress")); item.setPublishedTime(data.getString("publishedTime")); item.setLogisticsID(data.getString("logisticsID")); item.setCompanyName(data.getString("companyName")); } catch (Exception e) { e.printStackTrace(); } return item; }
/*解析TakeJson*/ public static CourierListItemBean parseTakeSearchJson(String jsonData) { CourierListItemBean item = new CourierListItemBean(); try { JSONObject jsonObject = new JSONObject(jsonData); JSONObject data = new JSONObject(jsonObject.getString("data")); item.setTel(data.getString("tel")); item.setExpressCompany(data.getString("expressCompany")); item.setUserID(data.getString("userID")); item.setReceiverCity(data.getString("receiverCity")); item.setPublishedTime(data.getString("publishedTime")); item.setAddressInfo(data.getString("addressInfo")); item.setLogisticsID(data.getString("logisticsID")); item.setExpressNum(data.getString("expressNum")); item.setIsOverWeight(data.getInt("isOverWeight")); item.setUserName(data.getString("userName")); item.setExpressNum(data.getString("expressNum")); } catch (Exception e) { e.printStackTrace(); } return item; }
/*解析总Json*/ public static ArrayList<CourierListItemBean> parseCourierSearchJson(String jsonData) { ArrayList<CourierListItemBean> items = new ArrayList<CourierListItemBean>(); try { JSONObject jsonObject = new JSONObject(jsonData); JSONArray data = new JSONArray(jsonObject.getString("data")); for (int i = 0; i < data.length(); i++) { CourierListItemBean item = new CourierListItemBean(); JSONObject json = data.getJSONObject(i); item.setUserName(json.getString("userName")); item.setTel(json.getString("tel")); item.setExpressNum(json.getString("expressNum")); item.setExpressName(json.getString("expressName")); item.setExpressID(json.getString("expressID")); item.setTag(json.getString("tag")); item.setLogisticsID(json.getString("logisticsID")); item.setPublishedTime(json.getString("publishedTime")); item.setExpressStatusID(json.getString("expressStatusID")); items.add(item); } } catch (Exception e) { e.printStackTrace(); } return items; }