Home > Net >  how to map complex json data into model class
how to map complex json data into model class

Time:01-20

about project: I am using following enter image description here

CodePudding user response:

have you tried creating them as sub classes

public class WeatherModel
{
    public long latitude { get; set; }
    public long longitude { get; set; }
    public long generationtime_ms { get; set; }
    public long utc_offset_seconds { get; set; }

    public string timezone { get; set; }
    public string timezone_abbreviation { get; set; }
    public string elevation { get; set; }
    
    Public class Hourly_Units {
         public string time { get; set; }
         public string temperature_2m { get; set; } 
    }   
    Public class Hourly {
         public List<string> time { get; set; }
    }   
}
  • Related