Iterate nested object with for loop

how can I get the values of a nested object in a loop? I need to iterate through both levels:

for (let unit in ds1.units) {      
    for (let ports in ds1.units[unit].switchPorts) {
        console.log(ports)
    }
}

}

Object looks like this:
Screen
There is no output. When I access the value with ds1.units[unit].switchPorts I get it. Also I get the unit after the first for loop.