【发布时间】:2017-09-07 17:25:30
【问题描述】:
让我从一个像这样的 JSon 对象开始
[
{
"id": 32837732,
"composer": {
"id": 536,
"name": "Francis Poulenc"
},
"title": "Of Thee I Sing: Overture (radio version)"
},
{
"id": 32837735,
"composer": {
"id": 245,
"name": "George Gershwin"
},
"title": "Concerto in F : I. Allegro"
},
{
"id": 32837739,
"composer": {
"id": 245,
"name": "George Gershwin"
},
"title": "Concerto in F : II. Adagio"
}
]
是否有可能使用 C#、Linq 以一种干净、声明性的方式获得类似 Json 的方式
{
'composer': [
{
'id': '536',
'name': 'Francis Poulenc'
},
{
'id': '245',
'name': 'George Gershwin'
},
]
}
这是一个 JSon 对象,每个作曲家都有唯一的子值(id 和 name)? 谢谢大家。
【问题讨论】: