我有一个从邮递员REST API调用中获取的对象,我在该对象中循环获取某些数据(名称,描述,URL)。当我遍历时,我将它们存储在数组中。当我在“ console.log(response.results [key] .data.properties.url)”这一行上记录数据时,我得到的URL很好。但是将它们添加到数组中后,我打印了数组,仅返回了2个网址。这是我的代码,您可以在JSnippet上运行它。
let response = {"results": [
{
"data": {
"properties": {
"container": false,
"container_size": 0,
"create_date": "2018-11-20T09:56:05",
"create_user_id": 2582434,
"description": "Learn how to perform Browse View Actions in Content Server Smart View 16.2.4. This video will show you how to filter, sort, favorite, open, and add items.",
"description_multilingual": {
"en": "Learn how to perform Browse View Actions in Content Server Smart View 16.2.4. This video will show you how to filter, sort, favorite, open, and add items."
},
"external_create_date": null,
"external_identity": "",
"external_identity_type": "",
"external_modify_date": null,
"external_source": "",
"favorite": false,
"id": 69107433,
"mime_type": null,
"modify_date": "2018-11-22T13:06:20",
"modify_user_id": 2582434,
"name": "How to perform Browse View actions in Smart View",
"name_multilingual": {
"en": "How to perform Browse View actions in Smart View"
},
"owner_group_id": 751247,
"owner_user_id": 2582434,
"parent_id": 69106987,
"reserved": false,
"reserved_date": null,
"reserved_user_id": 0,
"short_summary": "",
"size": null,
"size_formatted": "",
"summary": "",
"type": 140,
"type_name": "URL",
"url": "https://youtu.be/uGgLHbUykV4",
"versions_control_advanced": false,
"volume_id": -2001
},
"regions": {
"OTName": "How to perform Browse View actions in Smart View",
"OTName_expand": {
"value_index": 0,
"values": [
{
"attribute_map": {
"lang": "en"
},
"value": "How to perform Browse View actions in Smart View"
}
]
}
}
}
},
{
"data": {
"properties": {
"container": false,
"container_size": 0,
"create_date": "2018-11-20T09:56:05",
"create_user_id": 2582434,
"description": "Instruction video to install AppWorks Gateway",
"description_multilingual": {
"en": "Instruction video to install AppWorks Gateway"
},
"external_create_date": null,
"external_identity": "",
"external_identity_type": "",
"external_modify_date": null,
"external_source": "",
"favorite": false,
"id": 69107282,
"mime_type": null,
"modify_date": "2018-11-20T09:56:05",
"modify_user_id": 2582434,
"name": "Installing AppWorks Gateway",
"name_multilingual": {
"en": "Installing AppWorks Gateway"
},
"owner_group_id": 751247,
"owner_user_id": 2582434,
"parent_id": 69106987,
"reserved": false,
"reserved_date": null,
"reserved_user_id": 0,
"short_summary": "",
"size": null,
"size_formatted": "",
"summary": "",
"type": 140,
"type_name": "URL",
"url": "http://stage.ss.vidavee.com/vidad/sunnyside.vidavee.com/opentext/OTDocs/7486A99E41109E4141BCFB8078D036C8.mp4",
"versions_control_advanced": false,
"volume_id": -2001
},
"regions": {
"OTName": "Installing AppWorks Gateway",
"OTName_expand": {
"value_index": 0,
"values": [
{
"attribute_map": {
"lang": "en"
},
"value": "Installing AppWorks Gateway"
}
]
}
}
}
},
{
"data": {
"properties": {
"container": false,
"container_size": 0,
"create_date": "2018-11-20T15:11:01",
"create_user_id": 2582434,
"description": "Marketing Video",
"description_multilingual": {
"en": "Marketing Video"
},
"external_create_date": null,
"external_identity": "",
"external_identity_type": "",
"external_modify_date": null,
"external_source": "",
"favorite": false,
"id": 69107422,
"mime_type": null,
"modify_date": "2018-11-20T15:11:01",
"modify_user_id": 2582434,
"name": "Buy OpenText",
"name_multilingual": {
"en": "Buy OpenText"
},
"owner_group_id": 751247,
"owner_user_id": 2582434,
"parent_id": 69106987,
"reserved": false,
"reserved_date": null,
"reserved_user_id": 0,
"short_summary": "",
"size": null,
"size_formatted": "",
"summary": "",
"type": 140,
"type_name": "URL",
"url": "http://sunnyside.vidavee.com/opentext/doc/D2A8F0A6D155FE5D7CD4882FF2B5EE4A?AF_deliveryChannel=responsive&p3=on",
"versions_control_advanced": false,
"volume_id": -2001
},
"regions": {
"OTName": "Buy OpenText",
"OTName_expand": {
"value_index": 0,
"values": [
{
"attribute_map": {
"lang": "en"
},
"value": "Buy OpenText"
}
]
}
}
}
},
{
"data": {
"properties": {
"container": false,
"container_size": 0,
"create_date": "2018-11-20T09:56:05",
"create_user_id": 2582434,
"description": "Learn how to perform Document Actions in Content Server Smart View 16.2.4. This video will show you how to reserve, download, add a new version, unreserve, and edit documents.",
"description_multilingual": {
"en": "Learn how to perform Document Actions in Content Server Smart View 16.2.4. This video will show you how to reserve, download, add a new version, unreserve, and edit documents."
},
"external_create_date": null,
"external_identity": "",
"external_identity_type": "",
"external_modify_date": null,
"external_source": "",
"favorite": false,
"id": 69106725,
"mime_type": null,
"modify_date": "2018-11-22T13:07:43",
"modify_user_id": 2582434,
"name": "How to perform Document Actions in Smart View",
"name_multilingual": {
"en": "How to perform Document Actions in Smart View"
},
"owner_group_id": 751247,
"owner_user_id": 2582434,
"parent_id": 69106987,
"reserved": false,
"reserved_date": null,
"reserved_user_id": 0,
"short_summary": "",
"size": null,
"size_formatted": "",
"summary": "",
"type": 140,
"type_name": "URL",
"url": "https://youtu.be/GM36EiuBPp8",
"versions_control_advanced": false,
"volume_id": -2001
},
"regions": {
"OTName": "How to perform Document Actions in Smart View",
"OTName_expand": {
"value_index": 0,
"values": [
{
"attribute_map": {
"lang": "en"
},
"value": "How to perform Document Actions in Smart View"
}
]
}
}
}
},
{
"data": {
"properties": {
"container": false,
"container_size": 0,
"create_date": "2018-11-20T09:56:05",
"create_user_id": 2582434,
"description": "Learn how to access the basic Content Actions in Content Server Smart View 16.2.4. This video will show you how to use the Inline Action Bar, Action Bar, and Properties page to access basic Content Actions such as sharing, copying, and moving.",
"description_multilingual": {
"en": "Learn how to access the basic Content Actions in Content Server Smart View 16.2.4. This video will show you how to use the Inline Action Bar, Action Bar, and Properties page to access basic Content Actions such as sharing, copying, and moving."
},
"external_create_date": null,
"external_identity": "",
"external_identity_type": "",
"external_modify_date": null,
"external_source": "",
"favorite": false,
"id": 69106503,
"mime_type": null,
"modify_date": "2018-11-22T13:05:04",
"modify_user_id": 2582434,
"name": "How to access Content Actions in Smart View",
"name_multilingual": {
"en": "How to access Content Actions in Smart View"
},
"owner_group_id": 751247,
"owner_user_id": 2582434,
"parent_id": 69106987,
"reserved": false,
"reserved_date": null,
"reserved_user_id": 0,
"short_summary": "",
"size": null,
"size_formatted": "",
"summary": "",
"type": 140,
"type_name": "URL",
"url": "https://youtu.be/9htthQfRL1g",
"versions_control_advanced": false,
"volume_id": -2001
},
"regions": {
"OTName": "How to access Content Actions in Smart View",
"OTName_expand": {
"value_index": 0,
"values": [
{
"attribute_map": {
"lang": "en"
},
"value": "How to access Content Actions in Smart View"
}
]
}
}
}
},
{
"data": {
"properties": {
"container": false,
"container_size": 0,
"create_date": "2018-11-20T09:56:05",
"create_user_id": 2582434,
"description": "Learn what you can do with your profile in OpenText Content Server Smart View 16.2.4. This video will show you how to update your profile; add, edit, or delete comments in the activity feed; and customize your notification and security settings.",
"description_multilingual": {
"en": "Learn what you can do with your profile in OpenText Content Server Smart View 16.2.4. This video will show you how to update your profile; add, edit, or delete comments in the activity feed; and customize your notification and security settings."
},
"external_create_date": null,
"external_identity": "",
"external_identity_type": "",
"external_modify_date": null,
"external_source": "",
"favorite": false,
"id": 69107289,
"mime_type": null,
"modify_date": "2018-11-22T13:15:04",
"modify_user_id": 2582434,
"name": "Work with your profile in Smart View",
"name_multilingual": {
"en": "Work with your profile in Smart View"
},
"owner_group_id": 751247,
"owner_user_id": 2582434,
"parent_id": 69106987,
"reserved": false,
"reserved_date": null,
"reserved_user_id": 0,
"short_summary": "",
"size": null,
"size_formatted": "",
"summary": "",
"type": 140,
"type_name": "URL",
"url": "https://youtu.be/j-aOeCpRvEs",
"versions_control_advanced": false,
"volume_id": -2001
},
"regions": {
"OTName": "Work with your profile in Smart View",
"OTName_expand": {
"value_index": 0,
"values": [
{
"attribute_map": {
"lang": "en"
},
"value": "Work with your profile in Smart View"
}
]
}
}
}
},
{
"data": {
"properties": {
"container": false,
"container_size": 0,
"create_date": "2018-11-20T09:56:05",
"create_user_id": 2582434,
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ac pretium arcu, fringilla convallis nisl. Nullam id sem accumsan, lacinia turpis eget, volutpat tellus. Curabitur nibh velit, vestibulum quis blandit sed, viverra in lorem. Cras metus orci, tempor ut viverra eu, commodo quis velit.",
"description_multilingual": {
"en": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ac pretium arcu, fringilla convallis nisl. Nullam id sem accumsan, lacinia turpis eget, volutpat tellus. Curabitur nibh velit, vestibulum quis blandit sed, viverra in lorem. Cras metus orci, tempor ut viverra eu, commodo quis velit."
},
"external_create_date": null,
"external_identity": "",
"external_identity_type": "",
"external_modify_date": null,
"external_source": "",
"favorite": false,
"id": 69106511,
"mime_type": null,
"modify_date": "2018-11-22T13:57:21",
"modify_user_id": 2582434,
"name": "Installing Enterprise Connect",
"name_multilingual": {
"en": "Installing Enterprise Connect"
},
"owner_group_id": 751247,
"owner_user_id": 2582434,
"parent_id": 69106987,
"reserved": false,
"reserved_date": null,
"reserved_user_id": 0,
"short_summary": "",
"size": null,
"size_formatted": "",
"summary": "",
"type": 140,
"type_name": "URL",
"url": "http://stage.ss.vidavee.com/vidad/sunnyside.vidavee.com/opentext/OTDocs/7486A99E41109E4141BCFB8078D036C8.mp4",
"versions_control_advanced": false,
"volume_id": -2001
},
"regions": {
"OTName": "Installing Enterprise Connect",
"OTName_expand": {
"value_index": 0,
"values": [
{
"attribute_map": {
"lang": "en"
},
"value": "Installing Enterprise Connect"
}
]
}
}
}
},
{
"data": {
"properties": {
"container": false,
"container_size": 0,
"create_date": "2018-11-20T09:56:05",
"create_user_id": 2582434,
"description": "Learn how to perform the basic Content Actions in Content Server Smart View 16.2.4. This video will show you how to view metadata, rename, share, move, copy, and delete an item.",
"description_multilingual": {
"en": "Learn how to perform the basic Content Actions in Content Server Smart View 16.2.4. This video will show you how to view metadata, rename, share, move, copy, and delete an item."
},
"external_create_date": null,
"external_identity": "",
"external_identity_type": "",
"external_modify_date": null,
"external_source": "",
"favorite": false,
"id": 69106659,
"mime_type": null,
"modify_date": "2018-11-22T13:04:13",
"modify_user_id": 2582434,
"name": "How to perform Content Actions in Smart View",
"name_multilingual": {
"en": "How to perform Content Actions in Smart View"
},
"owner_group_id": 751247,
"owner_user_id": 2582434,
"parent_id": 69106987,
"reserved": false,
"reserved_date": null,
"reserved_user_id": 0,
"short_summary": "",
"size": null,
"size_formatted": "",
"summary": "",
"type": 140,
"type_name": "URL",
"url": "https://youtu.be/WhTlt9w2OR4",
"versions_control_advanced": false,
"volume_id": -2001
},
"regions": {
"OTName": "How to perform Content Actions in Smart View",
"OTName_expand": {
"value_index": 0,
"values": [
{
"attribute_map": {
"lang": "en"
},
"value": "How to perform Content Actions in Smart View"
}
]
}
}
}
},
{
"data": {
"properties": {
"container": false,
"container_size": 0,
"create_date": "2018-11-20T09:56:05",
"create_user_id": 2582434,
"description": "Learn what you can do with your profile in OpenText Content Server Smart View 16.2.4. This video will show you how to update your profile; add, edit, or delete comments in the activity feed; and customize your notification and security settings.",
"description_multilingual": {
"en": "Learn what you can do with your profile in OpenText Content Server Smart View 16.2.4. This video will show you how to update your profile; add, edit, or delete comments in the activity feed; and customize your notification and security settings."
},
"external_create_date": null,
"external_identity": "",
"external_identity_type": "",
"external_modify_date": null,
"external_source": "",
"favorite": false,
"id": 69107434,
"mime_type": null,
"modify_date": "2018-11-22T13:16:33",
"modify_user_id": 2582434,
"name": "Work with other users’ profiles in Smart View",
"name_multilingual": {
"en": "Work with other users’ profiles in Smart View"
},
"owner_group_id": 751247,
"owner_user_id": 2582434,
"parent_id": 69106987,
"reserved": false,
"reserved_date": null,
"reserved_user_id": 0,
"short_summary": "",
"size": null,
"size_formatted": "",
"summary": "",
"type": 140,
"type_name": "URL",
"url": "https://youtu.be/kzEIoZG80gU",
"versions_control_advanced": false,
"volume_id": -2001
},
"regions": {
"OTName": "Work with other users’ profiles in Smart View",
"OTName_expand": {
"value_index": 0,
"values": [
{
"attribute_map": {
"lang": "en"
},
"value": "Work with other users’ profiles in Smart View"
}
]
}
}
}
},
{
"data": {
"properties": {
"container": false,
"container_size": 0,
"create_date": "2018-11-20T09:56:05",
"create_user_id": 2582434,
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ac pretium arcu, fringilla convallis nisl. Nullam id sem accumsan, lacinia turpis eget, volutpat tellus. Curabitur nibh velit, vestibulum quis blandit sed, viverra in lorem. Cras metus orci, tempor ut viverra eu, commodo quis velit.",
"description_multilingual": {
"en": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ac pretium arcu, fringilla convallis nisl. Nullam id sem accumsan, lacinia turpis eget, volutpat tellus. Curabitur nibh velit, vestibulum quis blandit sed, viverra in lorem. Cras metus orci, tempor ut viverra eu, commodo quis velit."
},
"external_create_date": null,
"external_identity": "",
"external_identity_type": "",
"external_modify_date": null,
"external_source": "",
"favorite": false,
"id": 69106512,
"mime_type": null,
"modify_date": "2018-11-22T13:59:16",
"modify_user_id": 2582434,
"name": "Installing Records Management",
"name_multilingual": {
"en": "Installing Records Management"
},
"owner_group_id": 751247,
"owner_user_id": 2582434,
"parent_id": 69106987,
"reserved": false,
"reserved_date": null,
"reserved_user_id": 0,
"short_summary": "",
"size": null,
"size_formatted": "",
"summary": "",
"type": 140,
"type_name": "URL",
"url": "http://stage.ss.vidavee.com/vidad/sunnyside.vidavee.com/opentext/OTDocs/7486A99E41109E4141BCFB8078D036C8.mp4",
"versions_control_advanced": false,
"volume_id": -2001
},
"regions": {
"OTName": "Installing Records Management",
"OTName_expand": {
"value_index": 0,
"values": [
{
"attribute_map": {
"lang": "en"
},
"value": "Installing Records Management"
}
]
}
}
}
}
]};
var nameoOfLink = [];
descriptionOfVideo = [];
var urlOfVideo = [];
for(let key in response.results){
console.log(response.results[key].data.properties.url);
if(response.results[key].data.properties !== null){
nameoOfLink[nameoOfLink.length] =
response.results[key].data.properties.name;
descriptionOfVideo[descriptionOfVideo.length] =
response.results[key].data.properties.description;
urlOfVideo[urlOfVideo.length] =
response.results[key].data.properties.url;
}
}
console.log(urlOfVideo.toString());