Request: Per property converters

Jun 27, 2008 at 1:32 AM
If there is a way to do this already, please let me know.  Otherwise, I'd like to request a method to use an attribute on a property to be able to specify a certain converter to use for that one field only.  So, if I want to use a date converter for just one date on my object, then a different date converter for another date, I can specify them in the attributes on the property that can pick up.

Jul 2, 2008 at 9:01 PM

It would be great if the following was possible...

public DateTime StartDate { get; set; }

Being able to set a custom JsonConverter at the property level.

And a few overloads....

[JsonProperty("start", typeof(JavaScriptDateTimeConverter))]
public DateTime StartDate { get; set; }
Aug 4, 2008 at 9:42 AM

I have added a JsonConverterAttribute. It can be applied at a class or member level.

The JsonConverter priority of which is used is member attribute, class attribute, serializer argument, i.e. a member attribute converter will override the class attribute converter.