Citanje JSON datoteka(i ziponovanih) preko strima

PHOTO EMBED

Tue Oct 04 2022 12:47:07 GMT+0000 (Coordinated Universal Time)

Saved by @necamat #c#

// 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
}
content_copyCOPY

https://medium.com/geekculture/parsing-huge-json-files-using-streams-in-net-d620dace47e2