This project has moved and is read-only. For the latest updates, please go here.

Default converters

Apr 16, 2009 at 2:26 PM
Edited Apr 16, 2009 at 2:27 PM
Is there a way to specify default converters for different data types? For example I have CustomConverter that should allways be used for CustomDataType, now I have been specifying them for each property with [JsonConverter(typeof(CustomConverter))] but there should be some other better way to define it?
Apr 17, 2009 at 10:38 PM
Put the JsonConverter attribute on the CustomDataType class.
Apr 19, 2009 at 5:54 PM
Edited Apr 19, 2009 at 5:55 PM
It's 3rd party class so I can not. It would be nice if it could be possible to add some kind of mapping to serializer/deserialzier like .ConverterMapping.Add(typeof(CustomDataType), typeof(CustomConverter)).
Apr 20, 2009 at 9:17 AM
There is the Converters collection on the JsonSerializer class.