我正在尝试将对象序列化为json字符串,它看起来像
[
{
"Key": "Products",
"Items": [
{
"name": "ProductID",
"iskey": true,
"figure": "Decision",
"color": "green"
},
{
"name": "ProductName",
"iskey": false,
"figure": "Cube",
"color": "bluegrad"
},
{
"name": "SupplierID",
"iskey": false,
"figure": "Decision",
"color": "purple"
},
{
"name": "CategoryID",
"iskey": false,
"figure": "Decision",
"color": "purple"
}
]
},
{
"Key": "Suppliers",
"Items": [
{
"name": "SupplierID",
"iskey": true,
"figure": "Decision",
"color": "green"
},
{
"name": "CompanyName",
"iskey": false,
"figure": "Cube",
"color": "bluegrad"
},
{
"name": "ContractName",
"iskey": false,
"figure": "Decision",
"color": "purple"
},
{
"name": "Address",
"iskey": false,
"figure": "Decision",
"color": "purple"
}
]
}
]
如果你查看json我的属性也包含引号,如“name”我只想在json字符串中的名字我该怎么做,我的代码看起来像
var jj = JsonConvert.SerializeObject(nodeDataArray,Formatting.Indented);
其中nodeDataArray包含数据