【发布时间】:2015-11-30 19:45:16
【问题描述】:
我正在尝试处理带有嵌套关系的 JSONAPI 响应。 Ember-Data 目前正在提取“包含”属性中的所有数据并将其全部推送到正确的模型中,但我的“转录”对象和“提示点”对象之间的关系不起作用。 'video' 和 'transcription' 对象之间的关系工作正常,所以我需要帮助的就是嵌套部分。
这是我使用的数据示例:
{
"data":{
"type":"video",
"id":"55e0687ba1f9e8032c549680",
"attributes":{
"title":"Test32"
},
"relationships":{
"transcriptions":{
"data":[
{
"relationships":{
"cuepoints":{
"data":[
{
"id":"55e9b62446942224a0f456cc",
"type":"cuepoint"
}
]
}
},
"id":"55e0687ba1f9e8032c549680-transcription-0",
"type":"transcription"
}
]
}
}
},
"included":[
{
"type":"transcription",
"id":"55e0687ba1f9e8032c549680-transcription-0",
"attributes":{
"language":"English"
}
},
{
"type":"cuepoint",
"id":"55e9b62446942224a0f456cc",
"attributes":{
"cueIndex":0,
"startTimeMilliseconds":0,
"endTimeMilliseconds":4400,
"text":"- The first one is the L'Oreal Paris Extraordinary Oil."
}
}
]
}
知道我该如何处理吗?
【问题讨论】:
标签: ember.js ember-data json-api