public static void main(String[] args) throws JSONException {
String str = "{
"10": "婚姻情感",
"11": "教你脱单",
"13": "带娃相亲",
"14": "防骗指南"
}";
JSONObject jsonObject = new JSONObject(str);
Iterator<String> it = jsonObject.keys();
while(it.hasNext()){
// 获得key
String key = it.next();
String value = jsonObject.getString(key);
System.out.println("key: "+key+",value:"+value);
}
网友评论