2021
01-14
01-14
JAVA中JSONObject对象和Map对象之间的相互转换
1.由json字符串转换成Map对象如json字符串:{"contend":[{"bid":"22","carid":"0"},{"bid":"22","carid":"0"}],"result":100,"total":2}下面直接附代码://json字符串Stringjsondata="{\"contend\":[{\"bid\":\"22\",\"carid\":\"0\"},{\"bid\":\"22\",\"carid\":\"0\"}],\"result\":100,\"total\":2}";JSONObjectobj=JSON.parseObject(jsondata);//map对象Map<String,Object>data=newHashMap<>();//循环转换Iteratorit=...
继续阅读 >