假设这是我的api响应-
我需要使用for循环将followUpLists分配给FollowList数组吗?如何在类型记录中编码for循环?
{
"Info": [
{
"CustomerId": "3",
"CustomerName": "Sreejesh Panayappilly ",
"followUpLists": [
{
"CustomerId": "3",
"CustomerName": "Sreejesh Panayappilly ",
"ProductName": "OLT - GPON - V1600G0 - 4 PON PORT",
"MacId": "14A72BA2AFF2",
"AMCStartDate": "0001-01-01T00:00:00",
"AMCEndDate": "0001-01-01T00:00:00",
"AMCStatus": 1,
"FollowStatus": 0
},
{
"CustomerId": "3",
"CustomerName": "Sreejesh Panayappilly ",
"ProductName": "OLT - GPON - V1600G1 (B) - 8 PON PORT",
"MacId": "14A72BF09C40",
"AMCStartDate": "0001-01-01T00:00:00",
"AMCEndDate": "0001-01-01T00:00:00",
"AMCStatus": 1,
"FollowStatus": 0
}
]
},
{
"CustomerId": "5",
"CustomerName": "Priyamvadan",
"followUpLists": [
{
"CustomerId": "5",
"CustomerName": "Priyamvadan",
"ProductName": "OLT - GPON - V1600G1 (B) - 8 PON PORT",
"MacId": "14A72BF09B8C",
"AMCStartDate": "0001-01-01T00:00:00",
"AMCEndDate": "0001-01-01T00:00:00",
"AMCStatus": 1,
"FollowStatus": 1
}
]
},
],
"Status": true,
"Message": "Data Collected Successfully."
}我需要使用for循环将followUpLists数组分配给FollowList数组吗?如何在类型记录中编码for循环?
发布于 2022-08-09 06:41:11
也许试一试:
const FollowList = [];
yourObject.Info.map(e => FollowList.push(...e.followUpLists));https://stackoverflow.com/questions/73287343
复制相似问题