public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { if (value == null) { writer.WriteNull(); return; } Ref <TTarget> r = (Ref <TTarget>)value; Ref.ExtractIdentifier <TTarget, TID>(r, out TID id); _idConverter.WriteJson(writer, id, serializer); }