Here's the problem, I'm using a weather APi from Wunderground and am having trouble using GSON to fetch the weather.
import java.net.*;
import java.io.*;
import com.google.gson.*;
public class URLReader {
public static URL link;
public static void main(String[] args) {
try{
open();
read();
}catch(IOException e){}
}
public static void open(){
try{
link = new URL("http://api.wunderground.com/api/54f05b23fd8fd4b0/geolookup/conditions/forecast/q/US/CO/Denver.json");
}catch(MalformedURLException e){}
}
public static void read() throws IOException{
Gson gson = new Gson();
// Code to get variables like humidity, chance of rain, ect...
}
}
That is as far as I got, so can someone please help me to get this thing working. I need to be able to parse specific variables not just the entire JSON file.
I used a buffered reader but it read the entire JSON file.
Thanks in advance, I'm a beginner so go easy and explain things very straightforward :)