一、前端
1,读取json
//setconf为json对象
for (var j in setconf) {
console.log(j)
console.log(setconf[j])
}
2,字符串转json,json转字符串
var obj = JSON.parse(defaultStr);
JSON.stringify(jsonobj);
二、后端
使用的jar: org.json
JSONObject jsonObject = new JSONObject(content);
JSONObject setconf=jsonObject.getJSONObject("setconf");
Iterator<String> setconfcontent = setconf.keys();
while(setconfcontent.hasNext()){
String key = setconfcontent.next();
String value = setconf.getString(key);
System.out.println(key+":"+value);
}