namespace SystemTextJsonCommentNewlineProposal.Objects
private static void Main(string[] args)
var output = new MemoryStream();
var writer = new Utf8JsonWriter(output, new JsonWriterOptions()
writer.WriteCommentValue("This is a comment at the top of the document.");
writer.WriteStartObject();
writer.WritePropertyName("ObjectProperty");
writer.WriteCommentValue("This is a comment before an object value.");
writer.WriteStartObject();
writer.WritePropertyName("ChildProperty");
writer.WriteStringValue("Property Value");
output.Seek(0, SeekOrigin.Begin);
using var streamReader = new StreamReader(output);
Console.WriteLine(streamReader.ReadToEnd());