Get Yahoo Weather and Parse it in C#


Here’s a code i wrote for a sharepoint 2013 visual webpart which retrieves Istanbul’s temperature and condition text from Yahoo Weather (YQL) in JSON format and parsing.

string results = "";
using (WebClient wc = new WebClient())
results = wc.DownloadString("*%20from%20weather.forecast%20where%20woeid%3D2344116&format=json");

dynamic jo = JObject.Parse(results);
var items =;
var code = items.code;
var temp = items.temp;
var text = items.text;

Console.WriteLine(code + " - " + temp + " - " + text);



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s