首页 > 代码库 > web service json 数组解析

web service json 数组解析


    boolean workexpMark = true;
    // 美发师工作经历json数组解析
    org.json.JSONObject jsonObject = new org.json.JSONObject(
      workExperience);
 
    String array = jsonObject.getString("workExperence");
 
    org.json.JSONArray jsonArray = new org.json.JSONArray(array);
    
    int ja = jsonArray.length();
    String workExperienceIds="";
    for (int i = 0; i < ja; i++) {
     WorkExperience workExperienceBean = new WorkExperience();
     
     org.json.JSONObject object = jsonArray.getJSONObject(i);
     
     workExperienceBean.setContent(object.getString("content"));
     workExperienceBean.setDelStatus(false);
     workExperienceBean.setEndTime(object.getString("endTime"));
     workExperienceBean.setStartTime(object.getString("startTime"));
     workExperienceBean.setUpdateTime(updatetime);
 
     // 添加工作经历
     int workExperienceId=workExperienceService.addWorkExperience(workExperienceBean);
     if ( workExperienceId> 0) {
      workExperienceIds=workExperienceIds+workExperienceId+";";
     } else {
      workexpMark = false;
      map.put("success", 0);
     }
    }

web service json 数组解析