{
"Data": {
"namelist": [
{
"name": "Elson Mon",
"Information": {
"Age": 45.0,
"Height": 168.7,
"Weight": 75.4,
"Birthdate": "1992-03-03"
},
"Married Status": "Single"
}
]
}
}
这里是我的模型JSON数据
public class Information
{
public double Age { get; set; }
public double Height { get; set; }
public double Weight { get; set; }
public string Birthdate { get; set; }
}
public class Namelist
{
public string name { get; set; }
public Information Information { get; set; }
public string MarriedStatus { get; set; }
}
public class Data
{
public List<Namelist> namelist { get; set; }
}
public class RootObject
{
public Data Data { get; set; }
}
我如何反序列化JSON格式字符串并分配到变量? 我试图使用
dynamic jsonResponse = JsonConvert.DeserializeObject<RootObject>(json);
反序列化JSON数据,但对如何将其分配到不同的变量完全不知道。
'RootObject jsonResponse = JsonConvert.DeserializeObject(json);'? –
AgentFire