Skip to content

Instantly share code, notes, and snippets.

@kitelife
Created April 19, 2016 03:14
Show Gist options
  • Save kitelife/b3c783ee323d2e152beda054c6c41cc7 to your computer and use it in GitHub Desktop.
Save kitelife/b3c783ee323d2e152beda054c6c41cc7 to your computer and use it in GitHub Desktop.
private HashMap<String, Object> jsonToMap(String t) throws JSONException {
HashMap<String, Object> map = new HashMap<String, Object>();
JSONObject jObj = new JSONObject(t);
Iterator<?> keys = jObj.keys();
while (keys.hasNext()) {
String key = (String) keys.next();
map.put(key, jObj.get(key));
}
return map;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment