How can I achieve what I'm trying to do here:
public class MyClassName
{
[JsonProperty(nameof(MyProperty).ToJsonIdentifier())]
public bool MyProperty{ get; set; }
}
I have an extension method that can convert the string name of the property to the format I need. But this is not valid c# syntax. Is there a overload or ability to extend the JsonProperty decorator to allow me to specify a function to calculate the desired json property name.
Update: I have a suspicion that perhaps a lambda function could be passed in?
Update2: Is it possible that this would work?
public class MyClassName
{
[SubClassOfJsonProperty(() => nameof(MyProperty).ToJsonIdentifier())]
public bool MyProperty{ get; set; }
}