class JsonUtils {

    public static String json2xml(String jsonStr, Boolean pretty) {

        try {
            JSONObject jsonObj = new JSONObject(jsonStr);
            if (pretty) {
                // use the local class method which properly handles certain JSONArray content
                return XmlTool.normalize(toXMLString(jsonObj, null));
            } else {
                // use the local class method which properly handles certain JSONArray content
                return toXMLString(jsonObj, null);
            }
        } catch (Exception e) {
            logger.debug("json2xml(): unable to parse json and convert to xml. Exception was: {}", e.toString(), e);
            return null;
        }
    }

}