Share Link
Copied to clipboard
Embed on Your Page
Copied to clipboard
We Stand with Ukraine
How to read comments with System.Text.Json by dbc_MinLength
Environment version: .NET 9.0.0 (9.0.0)
System.Text.Json version: System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51

Input JSON: 
// A person
{
    "Id" : 1 /* Person's ID */,
    "Name" : "Foo" // Person's name
}            

Comments found in JSON using Utf8JsonReader:
   A person
   Person's ID 
   Person's name

Reserialized System.Text.Json.JsonDocument:
{
  "Id": 1,
  "Name": "Foo"
}
Re-serialized Person:
{"Id":1,"Name":"Foo"}
Cached Result
Last Run: 2:09:08 pm
Compile: 0.017s
Execute: 0.09s
Memory: 9.61Mb
CPU: 0.107s