Code snippet in Consume decoded JSON strings
in How to use a JSON document, Utf8JsonReader, and Utf8JsonWriter in System.Text.Json
does not compile
#35019
Labels
dotnet-fundamentals/svc
okr-quality
Content-quality KR: Concerns article defects (bugs), freshness, or build warnings.
📌 seQUESTered
Identifies that an issue has been imported into Quest.
I copy-pasted the code snippet from
Consume decoded JSON strings
section into my Visual Studio:and here is what I got:
all the symbols marked in red are not recognized. I searched a bit and looks like this is not a problem with my setup.
For example, Utf8JsonReader doesn't appear to have a
HasReadOnlySequence
member.It is also a bit confusing that the section says:
but refers to UTF-8. So is it UTF-8 or UTF-16 ?
I think the doc should provide near-obviously-compilable code snippets. At the very least it should explain what needs to be done to make the snippet compile, like what dependencies to import to get the right
Slice
method, how to implementParseUnescapedString
and so on.Related:
How to write custom converters for JSON serialization (marshalling) in .NET
should explain how to handle complex types #35020Utf8JsonReader
should explain how to obtain different kinds of objects from it, like e.g.JsonNode
. #35021Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
Associated WorkItem - 91665
The text was updated successfully, but these errors were encountered: