我有一组像这样的普通实体:
class Element
{
public int LongNameOfPropertyA { get; set;}
public int LongNameOfPropertyB { get; set;}
public string LongNameOfPropertyC { get; set;}
}
默认情况下,它序列化为:
[{
"LongNameOfPropertyA": "1",
"LongNameOfPropertyB": "2",
"LongNameOfPropertyC": "bla"
},
{
"LongNameOfPropertyA": "2",
"LongNameOfPropertyB": "3",
"LongNameOfPropertyC": "asdf"
}]
我的问题是有一个像这样序列化的选项:
[{
"entityName": "Element",
"columns": [
{ "columnName": "LongNameOfPropertyA" },
{ "columnName": "LongNameOfPropertyB" },
{ "columnName": "LongNameOfPropertyC" }],
"data": [
{ "columnData": ["1", "2"]},
{ "columnData": ["2", "3"]},
{ "columnData": ["bla", "asdf"]}]
}]
xml解决方案也是可以接受的