我有一个使用API的函数,并且不使用JSON
我想要的是,它仅过滤JSON中的某些特定元素,而不是所有元素,我该怎么做?
在此先感谢您的帮助
function getAllIssueForSCII(){
var options = {
method: 'GET',
url: '***',
headers: {
'Accept': 'application/json',
'Authorization': "***"
}
};
return new Promise(function (resolve) {
request(options, function (error, response, data) {
if (!error && response.statusCode === 200) {
console.log('JIRA login success!!')
var json = JSON.parse(data);
console.log(json); // display all element JSON
resolve(json);
} else {
console.log('error: ' + response.statusCode + ': ' + data.statusMessage)
}
})
})
实际结果 :
{
expand: 'schema,names',
startAt: 0,
maxResults: 50,
total: 2,
issues: [{
expand: 'operations,versionedRepresentations,editmeta,changelog,renderedFields',
id: '59032',
self: '**',
key: 'SCII-10',
fields: [Object]
},
{
expand: 'operations,versionedRepresentations,editmeta,changelog,renderedFields',
id: '59028',
self: '**',
key: 'SCII-7',
fields: [Object]
}
]
}
预期结果 :
{
issues: [{
key: 'SCII-10',
fields: id: 1
name: toto
time: now
},
相关分类