I want to convert XML String to a JSON object.
Below is the XML:
<request>
    <Products>
        <Product>
            <ProductName>H & M</ProductName>
            <quantity>1</quantity>
            <totalProductCost>17.03</totalProductCost>
        </Product>
    </Products>
</request>
This XML string comes as a request parameter.
httpReqMap is the map containing request parameters and their values.
When I execute this statement 
String reqstring = httpReqMap.get("request");
breaks the XML string in 2 parts. Thus the XML is invalid and I am unable to convert it to JSON Object.
I have tried to pass '&' as '&'.
Below is the code:
String reqstring = httpReqMap.get("request");
JSONObject jsonObject = XML.toJSONObject(httpReqMap.get("request"));
It should escape special character and convert XML to JSON.