I have a data set
$scope.mydata = [{
"Block_Devices": {
"bdev0": {
"Backend_Device_Path": "/dev/ram1",
"Capacity": "16777216",
"Bytes_Written": 1577,
"timestamp": "4365093970",
"IO_Operations": 17757,
"Guest_Device_Name": "vdb",
"Bytes_Read": 17793,
"Guest_IP_Address": "192.168.26.88"
},
"bdev1": {
"Backend_Device_Path": "/dev/ram2",
"Capacity": "16777216",
"Bytes_Written": 1975,
"timestamp": "9365093970",
"IO_Operations": 21380,
"Guest_Device_Name": "vdb",
"Bytes_Read": 20424,
"Guest_IP_Address": "192.168.26.100"
}
},
"Number of Devices": 2
}]
and I would like to create a array from this json such as
devices = ['bdev0', 'bdev1']
when I try
$scope.mydata.Block_Devices it gives me the whole json object but I just want the names of the objects i.e bdev0 and bdev1 how can I get that?
devices = Object.keys($scope.mydata[0].Block_Devices)