Created
May 18, 2012 14:27
-
-
Save markito/2725535 to your computer and use it in GitHub Desktop.
JSON Streaming API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ObjectMapper mapper = new ObjectMapper(); | |
Map<String, Object> map = mapper.readValue(jsonResponse, Map.class); | |
LinkedHashMap<String, Object> linkedMap = (LinkedHashMap) map.get("body"); | |
LinkedHashMap<String, Object> serverValues = (LinkedHashMap) linkedMap.get("item"); | |
if (serverValues == null) { | |
ArrayList list = (ArrayList) linkedMap.get("items"); | |
LOGGER.info(list); | |
} else { | |
Iterator it = serverValues.keySet().iterator(); | |
if (it != null) { | |
while (it.hasNext()) { | |
String key = (String) it.next(); | |
LOGGER.info(key + ":" + serverValues.get(key)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment