great project! I'm working with JSON, I need to convert XML into a JSONObject. Can you please, provide me with the sample code? Will that be a persistent JSONObject?
You should use XML.toJSONPObject method to convert the XML into an in-memory JSONObject. Then use one of the methods of JSONFactory class to persist this object. For example:
JSONObject inMemory = XML.toJSONObject("<xml one = 1 two=' \"2\" '><five></five>First \u0009<content><five></five> This is \"content\". <three> 3 </three>JSON does not preserve the sequencing of elements and contents.<three> III </three> <three> T H R E E</three><four/>Content text is an implied structure in XML. <six content=\"6\"/>JSON does not have implied structure:<seven>7</seven>everything is explicit.<![CDATA[CDATA blocks<are><supported>!]]></xml>");
JSONObject persistentOne = factory.getPersistentJSONObject("xmltest", inMemory.toString());
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.