我有一个数组,我需要摆脱顶级,我使用Angular7,我不知道如何从这个数组中拉出子对象。我想摆脱“顶级”级别,所以你只需要具有属性的对象。任何帮助,将不胜感激。
{
"toplevel": [
{
"SetName": "name1",
"description": "blah blah blah",
"managingEntitySource": "blah blah blah",
"effectiveDate": "01/01/9999",
"terminationDate": "01/01/9999",
"systemEffectiveDate": "01/01/9999",
"systemTerminationDate": "01/01/9999",
"comments": "blah blah blah",
"lastProcessDate": "01/01/9999"
},
{
"SetName": "name2",
"description": "blah blah blah",
"managingEntitySource": "blah blah blah",
"effectiveDate": "01/01/9999",
"terminationDate": "01/01/9999",
"systemEffectiveDate": "01/01/9999",
"systemTerminationDate": "01/01/9999",
"comments": "blah blah blah",
"lastProcessDate": "01/01/9999"
}
]
}
这是我正在寻找的:
[
{
"SetName": "name1",
"description": "blah blah blah",
"managingEntitySource": "blah blah blah",
"effectiveDate": "01/01/9999",
"terminationDate": "01/01/9999",
"systemEffectiveDate": "01/01/9999",
"systemTerminationDate": "01/01/9999",
"comments": "blah blah blah",
"lastProcessDate": "01/01/9999"
},
{
"SetName": "name2",
"description": "blah blah blah",
"managingEntitySource": "blah blah blah",
"effectiveDate": "01/01/9999",
"terminationDate": "01/01/9999",
"systemEffectiveDate": "01/01/9999",
"systemTerminationDate": "01/01/9999",
"comments": "blah blah blah",
"lastProcessDate": "01/01/9999"
}
]
var jsonObject = {
"toplevel": [
{
"SetName": "name1",
"description": "blah blah blah",
"managingEntitySource": "blah blah blah",
"effectiveDate": "01/01/9999",
"terminationDate": "01/01/9999",
"systemEffectiveDate": "01/01/9999",
"systemTerminationDate": "01/01/9999",
"comments": "blah blah blah",
"lastProcessDate": "01/01/9999"
},
{
"SetName": "name2",
"description": "blah blah blah",
"managingEntitySource": "blah blah blah",
"effectiveDate": "01/01/9999",
"terminationDate": "01/01/9999",
"systemEffectiveDate": "01/01/9999",
"systemTerminationDate": "01/01/9999",
"comments": "blah blah blah",
"lastProcessDate": "01/01/9999"
}
]
};
var innerArray = jsonObject.toplevel;
console.log(innerArray);