1、String转 JSONObject 并根据名称获取对应的值,
JSONObject jsObject = new JSONObject(wholeStr);
//result = JSONUtil.jsonArr2List(jsObject.get("HISTORY").toString());
String machine_number = jsObject.getString("machine_number");//两种方法得到java代码
String laser_state = jsObject.optString("laser_state");
String current_time = jsObject.optString("current_time");
2、String 转 JSONArray 转java List
List list = null;
JSONArray jsonArray = JSONArray.fromObject(x);
list = (List)jsonArray.toCollection(jsonArray,class);
标签:java,String,JSONArray,JSONObject,List,用法,JSON,jsObject
来源: https://blog.csdn.net/u013558123/article/details/89133827