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