我正在使用c#(但这与我的问题不太相关)来阅读一些JSON记录。
我得到的电影记录如下:
{
"items": [
{ "key": "3", "data": {"idx": "1", "movie-title": "Hangover 2", "duration": "102", "imdb_link": "http://www.imdb.com/title/tt1411697/"}}
]}
因此我使用以下JSON方案描述上述记录, 完美无瑕地工作:
{
"fields": [
{ "name": "idx", "type": "Edm.Int32" },
{ "name": "movie-title", "type": "Edm.String" },
{ "name": "duration", "type": "Edm.Int32" },
{ "name": "imdb_link", "type": "Edm.String" },
]
}
但是,我使用的API已更改,我也将获得电影的创作者。新数据记录的示例如下所示:
{
"items": [
{ "key": "3", "data": {"idx": "1", "movie-title": "Hangover 2", "duration": "102", "imdb_link": "http://www.imdb.com/title/tt1411697/", "creators": {"directors": ["Todd Phillips"]}}}
]}
我试图按如下方式编辑方案,但无法解析记录:
{
"fields": [
{ "name": "idx", "type": "Edm.Int32" },
{ "name": "movie-title", "type": "Edm.String" },
{ "name": "duration", "type": "Edm.Int32" },
{ "name": "imdb_link", "type": "Edm.String" },
{"name":"creators", "type": { "name": "directors", "type": "Collection(Edm.String)" }}
]
}
如何编辑我的json方案以包含这个新的变化呢?