- /**\r
- * Takes a text string representing a valid XML structure and converts it to\r
- * an equivalent JSON string.\r
- * \r
- * @param xmlText - The XML string to convert to JSON.\r
- * \r
- * @return - A JSON string representation of the supplied XML string.\r
- */\r
- public static String convertXmlToJson(String xmlText) {\r
- JSONObject jsonObj = XML.toJSONObject(xmlText);\r
- return jsonObj.toString();\r
- }\r
+ /**\r
+ * Takes a text string representing a valid JSON structure and converts it to an equivalent XML string.\r
+ * \r
+ * @param jsonText The JSON string to convert to XML.\r
+ * @return an XML string representation of the supplied JSON string.\r
+ */\r
+ public static String convertJsonToXml(String jsonText) {\r
+ return XML.toString(new JSONObject(jsonText));\r
+ }\r
+\r
+ /**\r
+ * Takes a text string representing a valid XML structure and converts it to an equivalent JSON string.\r
+ * \r
+ * @param xmlText The XML string to convert to JSON.\r
+ * @return a JSON string representation of the supplied XML string.\r
+ */\r
+ public static String convertXmlToJson(String xmlText) {\r
+ JSONObject jsonObj = XML.toJSONObject(xmlText);\r
+ return jsonObj.toString();\r
+ }\r