using System.Collections.Generic;
using System.Text.Json.Serialization;
public static void Main()
var jsonString = "{\"Date\": \"2019-08-01T00:00:00-07:00\", \"TemperatureCelsius\": 25, \"Summary\": \"Hot\", \"DatesAvailable\": [ \"2019-08-01T00:00:00-07:00\", \"2019-08-02T00:00:00-07:00\" ], \"SummaryWords\": {\"Temprature\": {\"Type\": \"Cool\"}} }";
var weatherForecast = JsonSerializer.Deserialize<WeatherForecastWithExtensionData>(jsonString);
Console.WriteLine(weatherForecast.ExtensionData["SummaryWords"].GetPropertyExtension("Temprature")?.GetPropertyExtension("Type"));
Console.WriteLine("Hello World");
public static class JsonElementExtenstion
public static JsonElement? GetPropertyExtension(this JsonElement jsonElement, string propertyName)
if (jsonElement.TryGetProperty(propertyName, out JsonElement returnElement))
public class WeatherForecastWithExtensionData
public DateTimeOffset Date { get; set; }
public int TemperatureCelsius { get; set; }
public string Summary { get; set; }
public Dictionary<string, JsonElement> ExtensionData { get; set; }