I wanted to add [JsonProperty("")] dynamically , how can I achieve this?
class Address
{
public string Number { get; set; }
public string Street { get; set; }
public string City { get; set; }
public string Country { get; set; }
}
class Person
{
public string Name { get; set; }
public int Age { get; set; }
public Address PostalAddress { get; set; }
}
F.e I wanted to add [JsonProperty("")] annotation to nested class at runtime.
class Address
{ [JsonProperty("Nmb")]
public string Number { get; set; }
[JsonProperty("Str")]
public string Street { get; set; }
public string City { get; set; }
public string Country { get; set; }
}
I need to add dynamically because the class I use is coming from other library. My target aim is getting serialized json with shortened attribute names. How can I do this?