📜  c# 将 json 文件读入对象 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:02.605000             🧑  作者: Mango

代码示例2
JObject o1 = JObject.Parse(File.ReadAllText(@"c:\videogames.json"));

// read JSON directly from a file
using (StreamReader file = File.OpenText(@"c:\videogames.json"))
using (JsonTextReader reader = new JsonTextReader(file))
{
    JObject o2 = (JObject)JToken.ReadFrom(reader);
}