I am logging the XML request that is received by the web service in JSON file. We have a class with all the attributes as follows:
class RequestExternal
{
[XmlAttribute("FirstName")]
[JsonProperty]
public string Firstname{get; set;}
[XmlAttribute("FirstName")]
[JsonProperty]
public string LastName{get; set;}
[XmlAttribute("FirstName")]
[JsonProperty] -- To be changed : Want to log this as PaymentCards.Count
public List<Object> PaymentCards{get; set;}
}
I want to log this request as:
{
FirstName: 'XXX',
LastName: 'XXX',
PaymentCount: **count of PaymentCard list**
}
Is there a way to do it via JsonConverter or something?
I can do it by introducing a new derived property.
But that will not work for me. we have a documentation mechanism which will expose those new property to the clients.