How to read/output a JSON as a normal String variable
Could someone please tell me how to convert JSON to a String variable so I can read it.
At the moment, my code is like this:
URL urban = new URL("http://www.urbandictionary.com/iphone/search/define?term=jad");
URLConnection yc = urban.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
int index_of = in.readLine().indexOf("n\":"); // dont worry about this line
System.out.println("index: "+index_of); //dont worry bout this
String output= in.readLine().toString();
System.out.println("Sentence output: "+output);
This is the output I get:
And I know the json has something in it because I opened it up in notepad. At the moment I am reading about json etc. but would like some input how I can store it as a string to view and read.