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