Hi @Kmcnet,
This JSON structure represents XML metadata, you could try following steps to deserialize the json.
Install package Microsoft.AspNetCore.Mvc.NewtonsoftJson
, then specify the property name by using Newtonsoft.Json;
public class Root
{
[JsonProperty("?xml")]
public XmlDetails Xml { get; set; }
}
public class XmlDetails
{
[JsonProperty("@version")]
public string Version { get; set; }
[JsonProperty("@encoding")]
public string Encoding { get; set; }
}
Set up default serializer in program.cs
builder.Services.AddControllers().AddNewtonsoftJson();
Test result:
{"?xml":{"@version":"1.0","@encoding":"utf-8"}}
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.