I have the following Json file:
{
"@odata.context": "https://mmtruevalves.cc",
"value": [
{
"Date": "2019-08-01T00:00:00-07:00",
"TemperatureCelsius": 25,
"Summary": "Hot",
"Quantity":45.88
}
]
}
And the following code:
public class WeatherForecast
{
public DateTimeOffset Date { get; set; }
public int TemperatureCelsius { get; set; }
public string? Summary { get; set; }
public decimal? Quantity { get; set; }
}
string jsonString = File.ReadAllText(fileName);
WeatherForecast weatherForecast =
JsonSerializer.Deserialize<WeatherForecast(jsonString)!;
Console.WriteLine($"Date: {weatherForecast.Date}");
Console.WriteLine($"TemperatureCelsius: {weatherForecast.TemperatureCelsius}");
Console.WriteLine($"Summary: {weatherForecast.Summary}");
I'm using the above code for class and processing but not getting desired results. I need proper class and processing so that I can get full results.