Package com.mirth.connect.userutil
Class JsonUtil
java.lang.Object
com.mirth.connect.userutil.JsonUtil
Provides JSON utility methods.
-
Method Details
-
prettyPrint
Formats an JSON string with indented markup.- Parameters:
input- The JSON string to format.- Returns:
- The formatted JSON string.
-
escape
Escapes any special JSON characters in the input.- Parameters:
input- The string to escape.- Returns:
- The escaped string.
-
toXml
Converts a JSON string to XML. This is the same as calling toXml(String jsonString, boolean multiplePI, boolean prettyPrint) with multiplePI = false and prettyPrint = false- Parameters:
jsonString- The JSON string to convert.- Returns:
- The converted XML string.
- Throws:
Exception- If the conversion failed.
-
toXml
public static String toXml(String jsonString, boolean multiplePI, boolean prettyPrint) throws Exception Converts a JSON string to XML.- Parameters:
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.- Returns:
- The converted XML string.
- Throws:
Exception- If the conversion failed.
-