package com.hx.gpsplatform.common.utils;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
/**
* json解析工具
* @author liuguo
*
*/
@ResponseBody
public class JsonUtils {
public static String readJosn(String jsonObj){
JSONObject jobj = JSONObject.parseObject(jsonObj);
String adrName ="";
JSONArray array=jobj.getJSONArray("addrList");
for(int i = 0; i < array.size(); i++){
JSONObject jsonItem = array.getJSONObject(i);
adrName = jsonItem.getString("addr");
}
return adrName;
}
}
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
/**
* json解析工具
* @author liuguo
*
*/
@ResponseBody
public class JsonUtils {
public static String readJosn(String jsonObj){
JSONObject jobj = JSONObject.parseObject(jsonObj);
String adrName ="";
JSONArray array=jobj.getJSONArray("addrList");
for(int i = 0; i < array.size(); i++){
JSONObject jsonItem = array.getJSONObject(i);
adrName = jsonItem.getString("addr");
}
return adrName;
}
}