0

I am building a simple Visual Basic program, for personal use only, that shows some basic weather forecast information. I did some looking around and decided that OpenWeather is my best option for getting the data.

I wrote a simple program, using the NewtonSoft JSON framework, which includes:

Dim myWeatherData As HttpClient
response = Await myWeatherData.GetAsync(useUrl)
responseBody = Await response.Content.ReadAsStringAsync()
myJSON = JObject.Parse(responseBody)

This code fine as I was able to see the JSON data using JsonConvert.SerializeObject. My question is simply this: Using the above code, would you please show me how to get inside of myJSON to access, for example, the predicted temperature two days from now? Thanks.

GRoston
  • 325
  • 1
  • 3
  • 12
  • We need to see the JSON to help you with that. See [ask]. If you just want to know how to index a `JToken` hierarchy, see e.g. [How do I get a deeply-nested property from JSON string?](https://stackoverflow.com/q/36324494/3744182) or [Json.NET get nested jToken value](https://stackoverflow.com/q/42290485/3744182). – dbc Dec 27 '21 at 23:03
  • I just wrote myJSON to a text file and is is available here: https://pairofdocs.net/wp-content/uploads/2021/12/json.txt – GRoston Dec 28 '21 at 17:20
  • Using the VS debugger, I look at the object myJSON and at the bottom of the list, I see Dynamic and I see values in Dynamic that are 'the same' to those in the text file. Does this provide any clue as to answering my question? If I then hit the + before list and then the + before Results (under list) I see the desired data... – GRoston Dec 29 '21 at 05:03

0 Answers0