API Reference
Class
JsonStreamExporter
Streaming JSON exporter to avoid materializing large datasets in memory.
Inheritance
- Object
- JsonStreamExporter
Methods
public static async Task ExportArrayAsync<T>(String path, IEnumerable<T> items, JsonTypeInfo<T> typeInfo, CancellationToken ct = null) #Returns:
TaskWrites an array of items to a JSON file using a streaming writer.
Type Parameters
- T
Parameters
- path System.String
- Destination file path. Created if it does not exist.
- items System.Collections.Generic.IEnumerable{System.Object}
- Enumerable of items to serialize.
- ct System.Threading.CancellationToken = null
- Optional cancellation token.
- options System.Text.Json.JsonSerializerOptions = null
- Optional serializer options (defaults to non-indented).
ExportArrayAsync``1 2 overloads
ExportArrayAsync``1(System.String path, System.Collections.Generic.IAsyncEnumerable{``0} items, System.Threading.CancellationToken ct, System.Text.Json.JsonSerializerOptions options) #Writes an async sequence of items to a JSON file as a top-level array.
Parameters
- path System.String
- Destination file path. Created if it does not exist.
- items System.Collections.Generic.IAsyncEnumerable{``0}
- Async sequence to serialize.
- ct System.Threading.CancellationToken
- Optional cancellation token.
- options System.Text.Json.JsonSerializerOptions
- Optional serializer options (defaults to non-indented).
ExportArrayAsync``1(System.String arg1, System.Collections.Generic.IEnumerable{``0} arg2, System.Text.Json.Serialization.Metadata.JsonTypeInfo{``0} arg3, System.Threading.CancellationToken arg4) #Typed streaming export using a source-generated JsonTypeInfo for AOT safety.
Parameters
- arg1 System.String
- arg2 System.Collections.Generic.IEnumerable{``0}
- arg3 System.Text.Json.Serialization.Metadata.JsonTypeInfo{``0}
- arg4 System.Threading.CancellationToken