This project has moved. For the latest updates, please go here.


Custom JsonConverter does not respect ItemTypeNameHandling option


After adding a custom JsonConverter using ItemConverterType which just calls serializer.Serialize(writer, value) and serializer.Deserialize(reader, objectType) (pass through without adding any new functionality), Json.NET stops generating $type property, even though ItemTypeNameHandling is set to Auto/All.

Example can be found in StackOverflow question:

The workaround is probably to change serializer.Serialize call to creating JObject and adding a $type property manually, but it will probably be considerably slower, and I think options set via attributes should still work even with custom converters if they use just serializer.Serialize.
Closed Jan 23, 2013 at 5:41 AM by JamesNK
Afraid a JsonConverter doesn't know about what context it is called under.