I'm trying to read in my android app JSON data from a website that returns JSON data with this code (in javascript):
document.body.innerHTML = "<pre style='word-wrap: break-word; white-space: pre-wrap;'>" + JSON.stringify(address, null, 4) + "</pre>";
Example website can be found here: Link
The problem is that fetching this website from android would return me the full html source-code instead of giving me only the body with the JSON data.
The code in android to fetch this would look like this:
URL url = new URL(apiURL);
connection = url.openConnection();
connection.connect();
InputStream stream = connection.getInputStream();
reader = new BufferedReader(new InputStreamReader(stream));
StringBuffer buffer = new StringBuffer();
String line = "";
while ((line = reader.readLine()) != null) {
buffer.append(line+"\n");
Log.d("Response: ", "> " + line);
}
So I don't know how to manage this... I can modify both, the website html or the android app, but I've tried everything and I didn't find a solution.
Can someone help?