OgrePyknic
New member
- Joined
- Sep 23, 2024
- Messages
- 1
- Programming Experience
- Beginner
I am pulling weather data from a Web API call which returns JSON which populates the following class:
There is a List inside it: DayInfo with the daily info for a number of days (see below).
How do I iterate through this list in the WeatherResponse object. eg: with a foreach.
Basically I need to insert the data for each day into an MS SQL table.
Thanks.
C#:
public class WeatherResponse
{
public string queryCost { get; set; }
public string latitude { get; set; }
public string longitude { get; set; }
public string resolvedAddress { get; set; }
public string address { get; set; }
public string timezone { get; set; }
public string tzoffset { get; set; }
public List<DayInfo> days { get; set; }
}
C#:
public class DayInfo
{
public string datetime { get; set; }
public string tempmax { get; set; }
public string tempmin { get; set; }
// etc..
}
Basically I need to insert the data for each day into an MS SQL table.
Thanks.