Created
September 15, 2011 23:29
-
-
Save wulfgarpro/1220791 to your computer and use it in GitHub Desktop.
Using Jackson's TreeModel to parse types from JSON
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(); | |
JsonNode rootNode = mapper.readValue(compoundCriteria, | |
JsonNode.class); | |
if(rootNode.has("ContextualCriteria")) | |
{ | |
JsonNode contextualNode = rootNode.get("ContextualCriteria"); | |
ContextualCriteria contextualCriteria = (ContextualCriteria) | |
fromJson(contextualNode.toString(), | |
ContextualCriteria.class); | |
query.addCriteria(contextualCriteria); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment