const myObj = {user1: {username: "alvin", id: 1}, user2: {username: "david", id: 2}} for(let key in myObj){ console.log(key, myObj[key]) } // output // user1 {username: "alvin",id: 1} // user2 {username: "alvin",id: 1}