javascript - how to push array of objects inside an object to an array with unique index js
问题描述
Question Explained:
I am doing a "for Each" loop to iterate key values and appending it with the api to get the response which is a single object. This object has a field called "issuselinks" which is a array of objects. My problem here is.. instead of storing the response object in an array i want to store the objects inside the "issueLinks" array into an array with separate index of each obj (i.e) issulinks[0] vaalue should sit in array[0] without looping the issuelinks. Thus my new array should contain objects of "issuselinks" instead of the whole response object. And I dont want to loop "issueLinks" and store it in a array since i already have more looping logic inside and which might go async. And if possible please tell me how to avoid loops.. which is going async. Thanks in advance!!
Here is my sample JSON Object:
{
"fields": {
"issuelinks": [
{
"id": "378753"
},
{
"id": "378752"
}
],
"assignee": null,
"customfield_10600": "9223372036854775807",
"customfield_12109": null,
"aggregatetimeestimate": null,
"comment": {
"comments": [],
"maxResults": 0,
"total": 0,
"startAt": 0
}
},
"customfield_10290": null,
"customfield_10291": null,
"customfield_10171": null,
"customfield_10053": "Req 21",
"customfield_10450": null,
"customfield_10451": null,
"customfield_10332": null,
"customfield_10453": null,
"customfield_11300": null,
"customfield_10455": null,
"customfield_12107": null,
}
解决方案
推荐阅读
- python - 我如何在 Pygame 屏幕上慢慢打印一些东西?
- c++ - OpenCV(C++):如何显示 yuv 文件?
- php - 在php中重新映射和分组数组中的重复值
- javascript - 仅当元素在屏幕上时如何播放动画
- ios - 如何使用 Capacitor 从应用程序的资产文件夹中下载图像,以便在 iOS 的照片应用程序中访问它
- email - 更新到流星 v1.11 后出错。冲突:约束 email@1.2.3 不满足 email 2.0.0
- excel - 从 Excel 中的另一个工作表的 vlookup 中为每个值重复行
- symfony - 即使在 Ctrl+Space 之后,PhpStorm 也不显示自动完成
- html5-canvas - 可以编写赛普拉斯脚本以模拟 2 个用户在同一个 HTML 画布上工作吗?
- c# - Unity 脚本在重新激活它所附加到的游戏对象后停止工作