{"result": { "total": "3", "shops": [ { "shopId": "8b615ce0", "shopName": "舒", "icon": }, { "shopId": "f6f83000a", "shopName": "二號", "icon": }, ]},"code": 0,"message": "OK","text": "OK"}JSONObject 對象rt 想要修改“shops” 對應(yīng)的值怎么修改??
4 回答

慕仙森
TA貢獻(xiàn)1827條經(jīng)驗(yàn) 獲得超8個贊
這是fastjson的例子
JSONObject json = JSON.parseObject("{val: 123}");
System.out.println("======before=====");
System.out.println("size: " + json.size());
System.out.println("val: " + json.get("val"));
json.put("val", 234); // 直接put相同的key
System.out.println("======after======");
System.out.println("size: " + json.size());
System.out.println("val: " + json.get("val"));
結(jié)果
======before=====
size: 1
val: 123
======after======
size: 1
val: 234
添加回答
舉報
0/150
提交
取消