code: public static String convertToJson(Node node) throws IOException {
          try (StringWriter writer = new StringWriter(); JsonGenerator generator = new JsonFactory().createGenerator(writer)) {
              convertToJson(node, generator, name -> name);
              return writer.toString();
          }
      }
docs: Simpler helper method to convert DOM node back to JSON. The node MUST
  have the "type" attributes (generated with addTypeAttributes flag set as
  true).
  
  @param node The DOM Node
  @return The JSON string
  @throws IOException