json字符串转jsonObject|| jsonArray
2018-03-26 22:00
441 查看
1.json字符串转jsonArray JSONArray json = (JSONArray) JSONArray.parse(str); for (Object obj : json) { JSONObject jo = (JSONObject)obj; int projectid= jo.getInteger("projectid"); String projectname= jo.getString("projectname"); System.out.println("projectid---" + projectid+ "---projectname---" + projectname); } 2.json字符串转成 json对象 JSONObject jsStr = JSONObject.parseObject(str); //将字符串{“id”:1} int jsID = Integer.parseInt(jsStr.getString("id"));//获取id的值
String projectNumber = jsStr.getString("projectNumber");
相关文章推荐
- Java (JSONArray、JSONObject、String字符串中)引号""替换成"-"
- org.json.JSONObject对象转json,json新增元素,根据json的key获取值。以及list对象格式字符串转jsonArray
- web服务端使用JSONArrayy或JSONObject转json字符串为Java对象或数组
- 关于json字符串以及JSONArray以及JSONObject
- json字符串转换为JSONObject和JSONArray
- json字符串转换为JSONObject和JSONArray .
- [转] json字符串转换为JSONObject和JSONArray
- json字符串转换为JSONObject和JSONArray .
- out.print(JSONArray.fromObject(al2)); 得到的是一个String类型的字符串
- java json字符串转JSONObject和JSONArray以及取值
- json字符串转换为JSONObject和JSONArray
- java json字符串转JSONObject和JSONArray以及取值
- json字符串转JSONObject及JSONArray
- JSONObject与JSONArray的Json字符串创建使用案例
- java json字符串转JSONObject和JSONArray以及取值
- 获取form表单的值并转化为字符串、JSONArray或JSONObject的方法及form取不到值的解决办法
- java json字符串转JSONObject和JSONArray以及取值
- json字符串转换为JSONObject和JSONArray
- json字符串转换为JSONObject和JSONArray
- 判断字符串是JSONObject 还是JSONArray?