I'm working on custom JsonConverter (where T is base type of objects supported by this converter) and I need to implement
public override T Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
method.
I have to read first property first to determine "target type" R, and then I want to pass whole JSON string to regular generic JsonConverter<R>(string json)
.
My problem is that I can't read two times from Utf8JsonReader and I can't find any method to read it as text.
Can I read all JSON and store it in some string buffer, so I can read it more than one time?
Yes, I know this will reduce performance a lot.