C#C
C#3y ago
Hugh

✅ Extracting an object from a Utf8JsonReader

I'm currently writing my own JsonConverter, and I've got the writer bit working fine. (simplified example below)

public override void Write(Utf8JsonWriter writer, MyClass value, JsonSerializerOptions options)
{
    writer.WriteString("name", value.Name);
    writer.WriteString("value", value.Value);
}


However, I'm struggling a bit to do the opposite of this in Read()

I have the Utf8JsonReader object in Read(), but the only thing that I can figure out is how to get a direct value from the reader, and can't get values by key from it.

What am I missing here?

Thanks
Was this page helpful?