The type or format of data received from the server using the web service depends entirely on the language in which the web service is running and the response code that the web service selects to format the data. .
Older web services or platforms mostly support the XML format. And new web services use the Json format for its light weight.
In your case, your web service supports both types of formats (XML, Json), and it selects the format according to the platform with which it receives the request (Mobile, Desktop). (Maybe it acts like a general web service).
One way to test the webservice response is to request it from the platform browser. Use your platform’s browser (desktop or mobile) to see the answer for your platform.
Finally, answer your question, Change the code on the server side and make sure that it returns the XML data as an answer for the platform for mobile devices (you do not need to worry about the code from the side of your application, all the changes that need to be made to the server).
However, you can also convert Json to xml as,
JSONObject Jobj = new JSONObject(jsonString);
Then you can get it in XML format using an XML class, for example:
String xml = org.json.XML.toString(Jobj);
but it is not recommended, because it takes extra processor time to convert Json to xml, and this can be a problem if your response data is huge.
source share