欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

C#获取json文件

程序员文章站 2022-03-04 13:06:39
...
String JSONtxt = File.ReadAllText(@"D:\\portals.json");//获取json文件
var myCommandMessage = (List<OnonGovOptions>)JsonConvert.DeserializeObject(JSONtxt, typeof(List<OnonGovOptions>));//强制
for (int i = 0; i < myCommandMessage.Count; i++)
{
    var options = new OnonGovOptions()
    {
        id = myCommandMessage[i].id,
        name = myCommandMessage[i].name,
        alias = myCommandMessage[i].alias,
        path = myCommandMessage[i].path,
        domain = myCommandMessage[i].domain
    };
    
}
//---GT

 

相关标签: C# Orchard Core