public static Node convertToDom ( final String json , final String namespace , final boolean addTypeAttributes , final String artificialRootName ) throws TransformerConfigurationException , TransformerException { Transformer transformer = TransformerFactory . newInstance ( ) . newTransformer ( ) ; InputSource source = new InputSource ( new StringReader ( json ) ) ; DOMResult result = new DOMResult ( ) ; transformer . transform ( new SAXSource ( new JsonXmlReader ( namespace , addTypeAttributes , artificialRootName ) , source ) , result ) ; return result . getNode ( ) ; }
Helper method to convert JSON string to XML DOM