2
我正在尝试处理嵌套关系的JSONAPI响应。 Ember-Data目前正在拾取'included'属性中的所有数据,并将其全部推送到正确的模型中,但'转录'对象和'cuepoint'对象之间的关系不起作用。 “视频”和“转录”对象之间的关系工作正常,所以它特别是我需要帮助的嵌套部分。JsonAPI与Ember数据嵌套关系
下面是我使用的数据的一个例子:
{
"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."
}
}
]
}
任何想法如何,我可以处理这个问题?
它是否在JSON API规范中的任何位置提及? –
引用:“另外,资源对象可以包含以下任何顶级成员: attributes:表示资源数据的属性对象 关系:描述资源与其他JSON API资源之间关系的关系对象 链接:包含与资源相关链接的链接对象 meta:元对象,包含有关无法表示为属性或关系的资源的非标准元信息。另见“A”关系对象上的位“必须至少包含以下之一......” – aceofspades
你是我的英雄。像魅力一样工作。你的解决方案是绝对有道理的,但是我的大脑因此被绊倒了。谢谢! –