© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
5 replies
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);
}
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()
Read()


I have the
Utf8JsonReader
Utf8JsonReader
object in
Read()
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
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Utf8JsonReader.GetString exceptions
C#CC# / help
3y ago
extracting data from a text file into an array
C#CC# / help
2y ago
Extracting string from string?
C#CC# / help
4y ago