Is it possible to directly convert a Java Object to an JsonNode-Object?
The only way I found to solve this is to convert the Java Object to String and then to JsonNode:
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(object);
JsonNode jsonNode = mapper.readTree(json);
As of Jackson 1.6, you can use:
JsonNode node = mapper.valueToTree(map);
or
JsonNode node = mapper.convertValue(object, JsonNode.class);
Source: is there a way to serialize pojo's directly to treemodel?