Java tutorial
//package com.java2s; import java.util.HashMap; import java.util.Iterator; import org.json.JSONObject; public class Main { public static HashMap<String, String> JSONObject2Map(JSONObject jsonObject) { HashMap<String, String> responseMap = new HashMap<String, String>(); try { @SuppressWarnings("unchecked") Iterator<String> keys = jsonObject.keys(); while (keys.hasNext()) { String key = (String) keys.next(); responseMap.put(key, jsonObject.getString(key)); } } catch (Exception e) { e.printStackTrace(); } return responseMap; } }