0
我正在使用Json.NET(也试过DataContractJsonSerializer),但我无法弄清楚如何处理没有命名的数组时串行化/ deserialising?我如何使用Json.NET或其他序列化程序序列化/反序列化Json *没有命名*数组
我的C#类是这个样子:
public class Subheading
{
public IList<Column> columns { get; set; }
public Subheading()
{
Columns = new List<Column>();
}
}
public class Column
{
public IList<Link> links { get; set; }
public Column()
{
Links = new List<Link>();
}
}
public class Link
{
public string label { get; set; }
public string url { get; set; }
}
正在生成JSON是这样的:
{
"columns": [
{
"**links**": [
{
"label": "New Releases",
"url": "/usa/collections/sun/newreleases"
},
...
]
},
]
...
}
我该怎么做,以松散的“链接”,使之像这样?:
{
"columns": [
[
{
"label": "New Releases",
"url": "/usa/collections/sun/newreleases"
},
...
],
...
]
...
}