json 取值

String jsonList="{"userId": 10,"userName": 李明,"phone": 18250555555},{"userId": 12, "userName": 刘琳,"phone": 132505565555},{"userId": 15, "userName": 张三丰,"phone": 13250555555}";jsonList = StringEscapeUtils.unescapeHtml4(jsonList);

JSONArray jsonArray = JSONArray.fromObject(jsonList);
 JSONObject jsonOne;
  for (int i = 0; i < jsonArray.size(); i++) { 
     jsonOne = jsonArray.getJSONObject(i); 
     Integer userId= jsonOne.getInt("userId");
     String userName = jsonOne.getInt("userName")     String phone = jsonOne.getInt("phone");
  }

猜你喜欢

转载自pxy.iteye.com/blog/2426364