解析键值对json
{
"a":"111",
"aa":"111",
"aaa":"111",
"aaaa":"111",
"aaaaa":"111"
}
import org.json.JSONObject;
try {
JSONObject jsonObjectMap = new JSONObject(mapJson);
Iterator<String> keys = jsonObjectMap.keys();
while (keys.hasNext()){
String key = keys.next();
String value = jsonObjectMap.getString(key);
System.out.println(key+"="+value);
}
} catch (JSONException e) {
e.printStackTrace();
}
网友评论