Closed
Description
This is a placeholder to uptake the recent IAsyncEnumerable
feature for the serializer.
This includes creating an enumerator class that that implements IAsyncEnumerable
and accepts a Stream
in its constructor (and others TBD) that contains the actual JSON which can be accessed asynchronously:
public class SerializerAsyncEnumerable<T> : IAsyncEnumerable<T>
{
public SerializerAsyncEnumerable(Stream stream);
public SerializerAsyncEnumerable(Stream stream, JsonSerializerOptions options);
...
}
and also likely exposed from the JsonSerializer
static class:
public static class JsonSerializer
{
...
public SerializerAsyncEnumerable<T> DeserializeEnumerableAsync(Stream stream);
public SerializerAsyncEnumerable<T> DeserializeEnumerableAsync(Stream stream, JsonSerializerOptions options);
...
}
The implementation will leverage the same patterns as in the existing async methods which preserve the unprocessed data from the stream (since the stream just returns raw JSON which won't align with object instances) and the "state" for continuing object deserialization as new JSON is obtained.