1

I have a collection of plain entities like this:

class Element
{
    public int LongNameOfPropertyA { get; set;}
    public int LongNameOfPropertyB { get; set;}
    public string LongNameOfPropertyC { get; set;}
}

By default it serializes to something like this:

[{
   "LongNameOfPropertyA": "1",
   "LongNameOfPropertyB": "2",
   "LongNameOfPropertyC": "bla"
},
{
   "LongNameOfPropertyA": "2",
   "LongNameOfPropertyB": "3",
   "LongNameOfPropertyC": "asdf"
}]

My question is there a option to serialize like this:

[{
    "entityName": "Element",
    "columns": [ 
        { "columnName": "LongNameOfPropertyA" },
        { "columnName": "LongNameOfPropertyB" },
        { "columnName": "LongNameOfPropertyC" }],
    "data": [
        { "columnData": ["1", "2"]},
        { "columnData": ["2", "3"]},
        { "columnData": ["bla", "asdf"]}]
}]

the xml solution will be also acceptable

gabba
  • 2,815
  • 2
  • 27
  • 48

0 Answers0