I'm trying to deserialize the following JSON:
{
"runtimeOptions": {
"tfm": "net6.0",
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
},
{
"name": "Microsoft.WindowsDesktop.App",
"version": "6.0.0"
}
],
"configProperties": {
"MaxTargets" : "1024"
}
}
}
My model class looks like:
public class OptionalInclude
{
[JsonProperty("configProperties")]
public string ConfigProperties { get; set; }
[JsonProperty("tfm")]
public string Tfm { get; set; }
[JsonProperty("frameworks")]
public IList<Dictionary<string, string>> Frameworks { get; set; }
}
I'm trying to deserialize in this way, but I need the MaxTargets value from the JSON:
var optionalIncludesConfig = File.ReadAllText(configPath);
result = (JObject)JsonConvert.DeserializeObject(optionalIncludesConfig);
var optionIncludes = new List<OptionalInclude>();
optionIncludes = result.ToObject<List<OptionalInclude>>();
