0
我有5個產品,價格爲12個月的列出以下格式轉換JSON從一種格式對象到另一個在C#
dynamic product = new JObject();
product.ProductName = "Elbow Grease";
product.Price = 4.90;
product.year = 2016;
product.month = 01;
product.ProductName = "Jeans";
product.Price = 4.10;
product.year = 2016;
product.month = 01;
product.ProductName = "Jeans";
product.Price = 2.90;
product.year = 2016;
product.month = 02;
,現在我需要這個JSON如下發送轉換爲另一種格式以我的觀點
[
{
"year": 2016,
"month": 01,
"Elbow Grease": 4.90,
"Jeans": 4.10
},
{
"year": "2016",
"month":"02",
"Elbow Grease": 0, //since not available
"Jeans": 2.90
}]
你確定你的json例子有效嗎? –