TreeNode tree = (TreeNode)object;
JsonFactory jfactory = new JsonFactory();
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
JsonGenerator generator = jfactory.createGenerator(buffer);
ObjectMapper mapper = new ObjectMapper();
mapper.writeTree(generator, tree);
data = buffer.toByteArray();
}
catch (IOException e) {
throw new UnsupportedOperationException("handle me gracefully", e);
}