public
Created

Using Jackson's TreeModel to parse types from JSON

  • Download Gist
gistfile1.java
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14
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);
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.