我有这个json
{
"Environments":[
{
"ConsoleLogFolderPath":"ConsoleLogs",
"Name":"Production",
"Browser":"BrowserStack",
"LogFile":"AutomationLogs.log",
"HomeUrl":"https://www.leesa.com/",
"ReportName":"Leesa Automation Report by Mohit",
"Image200KbOutputPath":"",
"BrokenImagesPath":""
},
{
"BrowserStackConfig":{
"Os_Version":"",
"Browser":"chrome",
"Browser_Version":"Latest",
"os":"Windows",
"User":"xxxxx",
"Key":"xxxxxxxxxxxx"
}
}
]
}
这些是我的班级属性
public class BrowserStackConfig
{
public string Os_Version { get; set; }
public string Browser { get; set; }
public string Browser_Version { get; set; }
public string os { get; set; }
public string User { get; set; }
public string Key { get; set; }
}
public class Environment
{
public string ConsoleLogFolderPath { get; set; }
public string Name { get; set; }
public string Browser { get; set; }
public string LogFile { get; set; }
public string HomeUrl { get; set; }
public string ReportName { get; set; }
public string Image200KbOutputPath { get; set; }
public string BrokenImagesPath { get; set; }
public BrowserStackConfig BrowserStackConfig { get; set; }
}
当我使用 JsonConvert 反序列化我的 json 时,它正在解析除 BrowserSTackConfig 对象之外的所有值,该对象以“null”形式出现。我不知道我错过了什么,对我来说一切都很好。
帮助表示赞赏!