What are some good tools to convert JSOM quickly and easily to Java? There are some great resources in
Maven Dependence:
& lt; Dependency & gt; & Lt; Group & gt; Org.json & lt; / Group & gt; & Lt; ArtifactId & gt; Json & lt; / ArtifactId> & Lt; Version & gt; 20160807 & lt; / Edition & gt; & Lt; / Dependencies & gt;
XML.java
is the class you are looking for:
import org.json.JSONObject; Import org.json.xml; Public Sector Main {Public Fixed In PRETTY_PRINT_INDENT_FACTOR = 4; Public Stabilized String TEST_XML_STRING = "& lt ;? Xml Version = \" 1.0 \ "? & Gt; Exam attrib = \" Maximize \ "& gt; Turn it on JSON & lt; / test & gt; ; Public static zero major (string [] args) {try {JSONObject xmlJSONObj = XML.toJSONObject (TEST_XML_STRING); String jsonPrettyPrintString = xmlJSONObj.toString (PRETTY_PRINT_INDENT_FACTOR); Println (jsonPrettyPrintString); } Hold (Jason Exception JE) {System.out.println (je.toString ()); }}}
Output is:
{"test": {"attrib": "moretest", "content": "it turned on JSON Do "}}
No comments:
Post a Comment