【发布时间】:2021-09-28 02:05:46
【问题描述】:
所以我想看看是否有人可以引导我朝着正确的方向前进。所以我想用多维数组构建一个对象,所以我有三个主要的东西需要分组:“Categories”、“Subheading”、“NoSubHeading”。
这是data.d.results的API响应。
我将它定义为var obj = Object.assign({}, data.d.results);的对象
所以我想构建这样的东西:
{
"Category": {
"Some Subheading": [
somepost,
someotherpost
],
"Some Other Subheading": [
anotherpost,
blah
],
"No Subheading": [
anotherpost,
blah
]
},
"Another Category": {
"Some Subheading": [
somepost,
someotherpost
],
"Some Other Subheading": [
anotherpost,
blah
]
}
}
如果有人能引导我朝着正确的方向前进,我们将不胜感激!
【问题讨论】:
标签: javascript jquery arrays object