Does the .NET provided System.Text.Json namespace provide an analogous service/class to Newtonsoft.Json's JsonReader/JsonTextReader?
Our new app has been built using only System.Text.Json dependencies but we now have a requirement to process extremely large JSON files (10's of GBs). This require us to read the files as a Stream sequentially as opposed to loading the entire objects into memory.
We were able to hook this up using Newtonsoft.Json's JsonReader/JsonTextReader but was wondering if this same functionality existed without using this external dependency and mixing Json libraries.
using (StreamReader sr = new(stream))
using (JsonReader jsonReader = new JsonTextReader(sr))
{
while (jsonReader.Read())
{
// Do Work
}
}
The System.Text.Json namespace provides the Utf8JsonReader class, which is analogous to JsonReader/JsonTextReader from Newtonsoft.Json.
Migrate from Newtonsoft.Json to System.Text.Json
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With