创建web项目:
string Json = string.Empty;
???????????string filePath = Server.MapPath("/***.json");//根目录下的文件
???????????using (FileStream fs = new FileStream(filePath, FileMode.Open, System.IO.FileAccess.Read, FileShare.ReadWrite))
???????????{
??????????????? using (StreamReader sr = new StreamReader(fs, Encoding.GetEncoding("gb2312")))
??????????????? {
??????????????????? Json = sr.ReadToEnd().ToString();
??????????????? }
???????????}
读取静态Json文件
原文地址:https://www.cnblogs.com/HenryWEI/p/9803265.html