package convertors;

import org.json.JSONException;
import org.json.JSONObject;
import org.json.XML;

public class XmlToJsonConverter {
    public static String convertXmlToJson(String xmlString) {
        String jsonString = null;
        try {
            JSONObject jsonObj = XML.toJSONObject(xmlString);
            jsonString = jsonObj.toString();
        }
        catch (JSONException e) {
            e.printStackTrace();
        }
        return jsonString;
    }
}

@@ -99,41 +99,250 @@
 L;%0A%0A
-public class XmlToJsonConverter %7B
+/**%0A * Convert data from xml to json fromat.%0A */%0Apublic class XmlToJsonConverter %7B%0A%0A    /**%0A     * Converts String in xml format to json format%0A     *%0A     * @param xmlString contains xml data%0A     * @return json representation of XML%0A     */
 %0A   

Add comments