This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes get the result of a URL query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "get the result of a URL query" Watch "get the result of a URL query" New topic

get the result of a URL query

Sukhwinder Brar

Joined: Feb 05, 2013
Posts: 1
Hi! I am developing a weather forecast application which uses OpenWeatherMaps API to find the forecasts for next seven days for a city. I am new to API as well as JSON. So, I have used the API as following:

public void findWeather(String city){

try {
URL myURL = new URL("" + city);
URLConnection myURLConnection = myURL.openConnection();

catch (MalformedURLException e) {
JOptionPane.showMessageDialog(null, e);
catch (IOException e) {
JOptionPane.showMessageDialog(null, e);

Now, if you try to copy the URL and paste it in your browser while replacing city by any city name, you get the result but they are in JSON I think. All I want is to parse that result into a table or list which I can display on my GUI.

Any kind of help is appreciated..
Paul Clapham

Joined: Oct 14, 2005
Posts: 19891

Yes, that's JSON. (I tried your URL with my city at the end and got a lot of JSON in my browser.)
I agree. Here's the link:
subject: get the result of a URL query
It's not a secret anymore!