Home > database >  C# use JsonExtensionData Server side
C# use JsonExtensionData Server side

Time:11-04

I´ve got a Request-Object which contains FirstName, LastName and Birthday. When ever a Client sends more Data than the object has, I want this properties written into JsonExtensionData property to track them and may extend the API. Therefor I´ve also a Controller which has the Request as parameter. But when I use the given Swagger the AdditionalData Property is present as Request Property and every additional Property is deleted on Request.

This the Request Class:

public class Request
{
    public DateTime BirthDay { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }

    [JsonExtensionData]
    public Dictionary<string, object> AdditionalData { get; set; }
}

EDIT:

In this enter image description here

And was submitting the request the Test-Attribute is written into the AdditionalData Attribute

enter image description here

  • Related