Closed
Description
As in subject, the section Use Utf8JsonReader
should explain how it can be converted to different types. For example, one can convert it to JsonNode
, by calling appropriate overload of JsonNode.Parse
:
JsonNode? jsonNode = JsonNode.Parse(ref reader);
Ideally the doc would also explain how to get out of Utf8JsonReader
in the simplest and most performant way:
JsonElement
(e.g.JsonElement.ParseValue
),JsonDocument
(e.g.JsonDocument.ParseValue
)- and given custom type
T
(e.g.JsonSerializer.Deserialize<T>
)
or link at least link to a document teaching the reader these types exists and how can be used together.
Related:
How to write custom converters for JSON serialization (marshalling) in .NET
should explain how to handle complex types #35020- Code snippet in
Consume decoded JSON strings
inHow to use a JSON document, Utf8JsonReader, and Utf8JsonWriter in System.Text.Json
does not compile #35019
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
- ID: 73a13d38-4904-c068-c9eb-e43176ce5338
- Version Independent ID: c5dfa4d2-c77a-e752-dae7-0bfae5756b76
- Content: How to use a JSON document, Utf8JsonReader, and Utf8JsonWriter in System.Text.Json
- Content Source: docs/standard/serialization/system-text-json/use-dom-utf8jsonreader-utf8jsonwriter.md
- Product: dotnet-fundamentals
- GitHub Login: @gewarren
- Microsoft Alias: gewarren