0

I have an object called datastore and it looks like this

dataStore = {
  folderDetails: [
    {
            "folderId": "123456",
            "folderName" : "folder1",
            "assignedCount" : 5,
            "unassignedCount" : 10,
            "completedCount" : 1000,
        chatRooms: [
                    {
                    "chatroomId" : "123455",
                    "chatroomName" : "test",
                    "status" : "assigned",
                    "lastMessage" : "hello",
                    "createdTs" : "1599570094209",
                    "updatedTs" : "1599570094209",
                    "updatedBy" : "Advisor",
                    "advisorId" : "Dave",
                    "folderId" : "123456"
                    }
        ]
    }
    ]
}
    

Folderdetail is an array, ChatRooms is another array, and in real data will have multiple folders, and each folder will have multiple chatrooms

Right now I am trying to access ChatroomId. How can I do it?

Can I just do something like this?

this.dataStore['folderDetails'][i].chatRooms[n].chatRoomId
Huang Xu
  • 93
  • 2
  • 8

0 Answers0