我有一个C#程序,我正在尝试将我的某些项目序列化为JSON数组,以便与笔形图兼容。但是,我无法弄清楚该如何做,我发现的所有示例都是关于反序列化的。我的对象是:
{
"file": {
"header" : {
"param1" : "test",
"param2" : "test2"
},
"points": [
{
"timestamp": "47602070",
"s1": "4",
"s2": "3",
},
{
"timestamp": "47602370",
"s1": "-4",
"s2": "2",
}
]
}
}
我需要的是:
{
"file": {
"header" : {
"param1" : "test",
"param2" : "test2"
},
"points": [
["47602070","4","3"]
["47602370","-4","2"]
]
}
}
基本上,在序列化时将所有Point对象转换为数组。使用JSON.NET自定义转换器可以轻松实现这一点吗?
亲切的问候