// Parsing json as a stream
await using FileStream file = File.OpenRead ( "data.json" ) ;
var options = new JsonSerializerOptions {
PropertyNaming Policy = JsonNaming Policy.CamelCase
} ;
IAsyncEnumerable < JsonNode ? > enumerablesonSerializer
.DeserializeAsyncEnumerable < JsonNode > ( file , options ) ;
await foreach ( JsonNode ? obj in enumerable ) {
var id = obj ? [ "id" ] ?.GetValue <int> () ;
// do things
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter