private Map<String, String> options = new HashMap<String, String>();
private void parseOptions(JSONObject json) throws JSONException {
Iterator<String> iter = json.keys();
while (iter.hasNext()) {
String key = iter.next();
options.put(key, json.getString(key));
}
}
private JSONObject optionsToJSON() throws JSONException {
JSONObject json = new JSONObject();
Iterator<String> iter = options.keySet().iterator();
while (iter.hasNext()) {
String key = iter.next();
json.put(key, options.get(key));
}
return json;
}
Java JSONObject与Map互相转换
猜你喜欢
转载自blog.csdn.net/qq_30552993/article/details/51180464
今日推荐
周排行