Stop Hand-Rolling JSON Lines With WriteLine: .NET 11 Writes Them for You
.NET 11 gives System.Text.Json the writer that JSON Lines (JSONL) always lacked: new SerializeAsyncEnumerable overloads take an IAsyncEnumerable<T> and write it to a Stream or a PipeWriter in one call. With topLevelValues: true every record is emitted compactly followed by an LF, so the malformed files produced by hand-rolled WriteLine loops disappear. It ships in .NET 11 RC 2, not yet GA.