Skip to content

EgorKrivosheev/converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Converter

Java: 8, 2 dependencies (JUnit, Annotations)

Install: Add this to pom.xml:

<dependency>
  <groupId>by.grodno.krivosheev</groupId>
  <artifactId>converter</artifactId>
  <version>RELEASE</version>
</dependency>

Objects

JsonObject, XmlObject

Get JSON object from string

String jsonStr = "{\"key\":\"value\"}";
JsonObject jsonObj = new JsonObject(jsonStr);

Get XML object from string

String xmlStr = "<key>VALUE</key>";
XmlObject xmlObj = new XmlObject(xmlStr);

Convert

Convert JSON object to XML object

String jsonStr = "{\"key\":\"value\"}";
JsonObject jsonObj = new JsonObject(jsonStr);
XmlObject xmlObj = Converter.jsonToXml(jsonObj);

Convert XML object to JSON object

String xmlStr = "<key>VALUE</key>";
XmlObject xmlObj = new XmlObject(xmlStr);
JsonObject jsonObj = Converter.xmlToJson(xmlObj);

License

MIT