0

So, basically i have this function:

public String ReadingURL(String IncomingURL){
    String prueba = "";
    try{
        URL url = new URL (IncomingURL);

        BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
        String line;
        while((line = in.readLine()) != null){
            prueba+=prueba;
        }
        in.close();
        return prueba;
    }
    catch (MalformedURLException e){
        System.out.println("Malformed URL: "+ e.getMessage());
        return "Error";
    }
    catch(IOException e){
        System.out.println("I/O Error: " + e.getMessage());
        return "Error";
    }
}

It's supposed to read line by line of an URL and extract the content. What this URL is gonna contain is basically a JSON Object but like in plain text, what i need to do is to grab "prueba" that contains the content of the URL and convert that into an actual JSON Object so i can later send a print command with the contents of that JSON . I'm new to JSON so be gentle haha

0 Answers0