public class JsonUtil extends Object
Modifier and Type | Method and Description |
---|---|
static String |
escape(String input)
Escapes any special JSON characters in the input.
|
static String |
prettyPrint(String input)
Formats an JSON string with indented markup.
|
static String |
toXml(String jsonString)
Converts a JSON string to XML.
|
static String |
toXml(String jsonString,
boolean multiplePI,
boolean prettyPrint)
Converts a JSON string to XML.
|
public static String prettyPrint(String input)
input
- The JSON string to format.public static String escape(String input)
input
- The string to escape.public static String toXml(String jsonString) throws Exception
jsonString
- The JSON string to convert.Exception
- If the conversion failed.public static String toXml(String jsonString, boolean multiplePI, boolean prettyPrint) throws Exception
jsonString
- The JSON string to convert.multiplePI
- If true, the <? xml-multiple ... ?>
processing instruction will
be included for arrays.prettyPrint
- Whether or not to fully indent the XML output.Exception
- If the conversion failed.