读取JSON文件可以用JSON库,示例代码: #coding:utf-8 import json with open("msg.json") as jsonfile: json_data = json.load(jsonfile) for key in json_data: val = json_data[key] print key + '\t' + val
先创建一个web项目,在根目录放置需要转换的json文件,直接读取静态Json文件加载数据进行转换,代码如下: string Json = string.Empty; List<object> list = new List<object>(); string filePath = Server.MapPath("/***.json");//指定目录下的json文件(当前为根目录) using (FileStream fs = new FileStream(fi