So I’m sitting here with Google Geocoder, which returns an XML via ‘GOOGLE_URL/xml?address=input&sensor=false’.
I need to fetch it by using Java and parse it into a JSON object and send it onwards.
How would I go about to do this? (No this is not homework)
Note that it should preferably be done within the standard libraries. At the moment I’m trying to work out if it can be done with for example SAX.
Here is a working example which shows how to connect to a URL, download XML and convert it to JSON format:
Connect to a URL and download the XML as a string:
Download the JSON library from here. (You will have to compile it and ensure that the classes are on your classpath.)
Convert the XML into a JSON Object: