c# 读取json文件返回字符串

一、
string json = string.Empty;
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();
}
} **
二、

    string filepath = Server.MapPath("~/Views/OrderInfoKJ/json1.json");  
    string json = GetFileJson(filepath);  

你可能感兴趣的:(MVC,json,c#)