org.json.Json Object的put和append方法比较
json.append(key,value) 会把 value 包装成一个数组
JSONObject append = new JSONObject().append("a", "aa").append("b", "bb");
JSONObject put = new JSONObject().put("c", "ccc").put("d", "ddd"); System.out.println("append : " + append); System.out.println("put : "+put);
结果:
append : {"b":["bb"],"a":["aa"]} put : {"d":"ddd","c":"ccc"}