![]() ![]() Using dataStream As Stream = response.GetResponseStream Using response As HttpWebResponse = DirectCast(request.GetResponse, HttpWebResponse) Private Shared Function GetStringFromURL(ByVal url As String) As Stringĭim request As WebRequest = WebRequest.Create(url) RetVal = JsonConvert.DeserializeObject(Of RootObject)(jsonString) Sb.Append("/conditions/q/CA/San_Francisco.json")ĭim jsonString As String = GetStringFromURL(sb.ToString) If Not String.IsNullOrWhiteSpace(wuKey) Thenĭim sb As New ("") Public Shared Function GetCurrentConditions(ByVal wuKey As String) As RootObject Public NotInheritable Class CurrentConditions The following is from a series of online conversions and it needs a LOT of cleaning up, but it'll get you started: If you go to the bottom of that page and click "Show Reponse", you'll see the resultant JSON.Īs Les pointed out, NewtonSoft has some good tools to work with including the ability to deserialize JSON into classes - but therein lies the rub. I'll let you work out getting the location data - WU is pretty flexible about that but this I'll just use their example as shown here: The user will need to be able to type their zip code in when the program starts up to get the information. I want to use the JSON so that way the program will load the information faster and more efficient. I don't have any experience using JSON to get information from an API and items that show you how to decodeĪ JSON feed don't work with the Weather Underground API. I would like to use the Weather Underground API in JSON format instead of the XML format to get weather alerts, conditions, forecasts, radar, etc. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |