获取JSONObject中的某个属性的方法

原数据
{“result”:1,“stores”:[{“storeId”:86,“startDate”:20181024,“endDate”:20181108}],“errormsg”:“处理成功”}

JSONObject jsonbject = JSONObject.fromObject(httpPost4Instream);
net.sf.json.JSONArray jsonArray = jsonbject.getJSONArray("stores");
String string = jsonArray.getString(0);
JSONObject fromObject = JSONObject.fromObject(string);
String startDate = fromObject.getString("startDate");
String endDate = fromObject.getString("endDate");
param.setFromDate(Long.valueOf(startDate).longValue());
param.setToDate(Long.valueOf(endDate).longValue());
FanStoreAwardVO FanStoreAward = fanAwardService.getAllFanStoreAward(param);
FanStoreAward.setFromDateNew(Integer.valueOf(startDate).intValue());
FanStoreAward.setToDateNew(Integer.valueOf(endDate).intValue());
map.put("FanStoreAward", FanStoreAward);

你可能感兴趣的:(java)