I have a custom JsonConverter which handles the creation of derived types during deserialization, in most cases this works as expected. The situation where I have an issue is, when there are referenced objects in the json structure. Is it possible to rely on the default deserialization when we detect a reference? What should the ReadJson method return? In the sample below we return null in case of a reference.
if (reader.TokenType == JsonToken.Null) return null;
var jObject = JObject.Load(reader);
JToken token;
if (jObject.TryGetValue("$ref", out token))
{
return null;
}
Or must we implement a custom ReferenceResolver as the default one can't be used in the converter (only internal use)?
Any suggestions are welcome.