Package io.github.astrapi69.json
Class JsonToXmlExtensions
- java.lang.Object
-
- io.github.astrapi69.json.JsonToXmlExtensions
-
public final class JsonToXmlExtensions extends java.lang.ObjectThe classJsonToXmlExtensionshelps to transform a given json string to an xml string.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringtoXml(java.lang.String jsonString)Transform the given json asStringobject to a xml asStringobjectstatic java.lang.StringtoXml(java.lang.String jsonString, int indent)Transform the given json asStringobject to a xml asStringobjectstatic java.lang.StringtoXml(java.lang.String jsonString, int indent, boolean withHeader)Transform the given json asStringobject to a xml asStringobjectstatic java.lang.StringtoXml(java.lang.String jsonString, int indent, boolean withHeader, boolean withRootTag, java.lang.String rootTagName)Transform the given json asStringobject to a xml asStringobject
-
-
-
Method Detail
-
toXml
public static java.lang.String toXml(java.lang.String jsonString) throws org.json.JSONExceptionTransform the given json asStringobject to a xml asStringobject- Parameters:
jsonString- the json asStringobject- Returns:
- the transformed xml as
Stringobject - Throws:
org.json.JSONException- if there is a syntax error in the source string or a duplicated key
-
toXml
public static java.lang.String toXml(java.lang.String jsonString, int indent) throws org.json.JSONExceptionTransform the given json asStringobject to a xml asStringobject- Parameters:
jsonString- the json asStringobjectindent- the indent is the number of spaces to add to each level of indentation- Returns:
- the transformed xml as
Stringobject - Throws:
org.json.JSONException- if there is a syntax error in the source string or a duplicated key
-
toXml
public static java.lang.String toXml(java.lang.String jsonString, int indent, boolean withHeader) throws org.json.JSONExceptionTransform the given json asStringobject to a xml asStringobject- Parameters:
jsonString- the json asStringobjectindent- the indent is the number of spaces to add to each level of indentationwithHeader- the flag that indicates if an xml header should be added- Returns:
- the transformed xml as
Stringobject - Throws:
org.json.JSONException- if there is a syntax error in the source string or a duplicated key
-
toXml
public static java.lang.String toXml(java.lang.String jsonString, int indent, boolean withHeader, boolean withRootTag, java.lang.String rootTagName) throws org.json.JSONExceptionTransform the given json asStringobject to a xml asStringobject- Parameters:
jsonString- the json asStringobjectindent- the indent is the number of spaces to add to each level of indentationwithHeader- the flag that indicates if a xml header should be addedwithRootTag- the flag that indicates if a root tag will be addedrootTagName- the name of the root tag- Returns:
- the transformed xml as
Stringobject - Throws:
org.json.JSONException- if there is a syntax error in the source string or a duplicated key
-
-