我正在尝试解析 JSON 文件并插入 SQL DB。只要文件很小(小于 5 MB),我的解析器就可以正常工作。
尝试读取大(> 5MB)文件时出现“内存不足异常”。
if (System.IO.Directory.Exists(jsonFilePath))
{
string[] files = System.IO.Directory.GetFiles(jsonFilePath);
foreach (string s in files)
{
var jsonString = File.ReadAllText(s);
fileName = System.IO.Path.GetFileName(s);
ParseJSON(jsonString, fileName);
}
}
我尝试了 JSONReader 方法,但没有运气将整个 JSON 转换为字符串或变量。请告知。