【发布时间】:2017-06-15 08:29:56
【问题描述】:
我正在尝试使用 NewtonSoft json 4.5 解析为以下 json 字符串:
{
"Name":"Henrik",
"Children":[
{
"Name":"Adam",
"Grandchildren":[
"Jessica", //How can i only show the value and not the property name?
"Michael"
]
}
]
}
我将序列化为 json 的对象如下所示:
public class Parent
{
public string Name { get; set; }
[JsonProperty(PropertyName = "Children")]
public List<Child> Childs { get; set; }
}
public class Child {
public string Name { get; set; }
[JsonProperty(PropertyName = "Grandchildren")]
public List<GrandChild> GrandChilds { get; set; }
}
public class GrandChild {
[JsonProperty(PropertyName = "")]
public string Name { get; set; }
}
我尝试将属性名称设置为空,但它并没有解决问题。
【问题讨论】:
标签: json.net