1.JSONObject表示对象json:{"name":"tom"}
JSonObject jsonObject = new JSonObject(json);
2.JSONArray表示数组json:["tom","kate"]
JSonArray jsonArray = new JSonArray(json);
后端中想把一个json字符串(键值对形式)转化为对象的方法:
其中data是“键值对”形式的json字符串。
JSonObject jsonObject = JSON.parseObject(data);
如果想从刚刚获得的jsonObject对象中获取对象里面的数组:可以用JSONArray:
JSonArray jsonArray = jsonObject.getJSonArray("arrays");
如果刚刚获得的数组对象里面还包含的有很多对象,并且对象里还包含数组:如何获得里面的数组
for(int i = 0;i参考博客:
(1)https://www.cnblogs.com/fu512/p/7595144.html
(2)https://blog.csdn.net/weixin_42204641/article/details/82850659



