Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public HashMap<String, Object> jsonToHashMap(JSONObject jsonObj)
- {
- HashMap<String, Object> hashRet = new HashMap<String, Object>();
- String[] names = JSONObject.getNames(jsonObj);
- for (String name : names)
- {
- try
- {
- hashRet.put(name, jsonObj.getInt(name));
- continue;
- }
- catch (Exception e)
- {
- }
- try
- {
- hashRet.put(name, jsonObj.getString(name));
- continue;
- }
- catch (Exception e)
- {
- }
- }
- return hashRet;
- }
Add Comment
Please, Sign In to add comment