如何将 'entities' 的子对象移动到顶层并在 normalizr 中重命名 'results' 对象?
How do I move child objects of 'entities' up to the top level and rename 'results' object in normalizr?
现在当我标准化这个数组时:
[
{
"teamName":"abc",
"description":"",
"id":"123"
},
{
"teamName":"def",
"description":"",
"id":"456"
}
]
Normalizr 输出:
{
"result":[
"123",
"456"
],
"entities":{
"teams":{
"123":{
"teamName":"abc",
"description":"",
"id":"123"
},
"456":{
"teamName":"def",
"description":"",
"id":"456"
}
}
}
}
纯粹修改schema,有没有办法输出这个?
{
"queries":[
"123",
"456"
],
"teams":{
"123":{
"teamName":"abc",
"description":"",
"id":"123"
},
"456":{
"teamName":"def",
"description":"",
"id":"456"
}
}
}
我知道事后我可以很容易地做到这一点,但是有没有内置的方法来调整输出的 JSON 数据的结构?
Normalizr 旨在通过两个顶级键 results
和 entities
为所有输出提供标准响应。没有执行您请求的选项。
现在当我标准化这个数组时:
[
{
"teamName":"abc",
"description":"",
"id":"123"
},
{
"teamName":"def",
"description":"",
"id":"456"
}
]
Normalizr 输出:
{
"result":[
"123",
"456"
],
"entities":{
"teams":{
"123":{
"teamName":"abc",
"description":"",
"id":"123"
},
"456":{
"teamName":"def",
"description":"",
"id":"456"
}
}
}
}
纯粹修改schema,有没有办法输出这个?
{
"queries":[
"123",
"456"
],
"teams":{
"123":{
"teamName":"abc",
"description":"",
"id":"123"
},
"456":{
"teamName":"def",
"description":"",
"id":"456"
}
}
}
我知道事后我可以很容易地做到这一点,但是有没有内置的方法来调整输出的 JSON 数据的结构?
Normalizr 旨在通过两个顶级键 results
和 entities
为所有输出提供标准响应。没有执行您请求的选项。