Once I retrieve my data from firebase, the result is an object containing multiple child objects.
myObj =
{
"J251525" : {
"email" : "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6c3823212c212d2520422f2321">[email protected]</a>",
"description" : "CLEAN THE HOUSE",
"refNumber" : "J251525"
},
"J512912" : {
"email" : "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0248434f4751424f434b4e2c414d4f">[email protected]</a>",
"description " : "BRUSH HORSE",
"refNumber" : "J512912"
},
"J53f512" : {
"email" : "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b6fef7e4e4eff6fbf7fffa98f5f9fb">[email protected]</a>",
"description " : "WASH CAR",
"refNumber" : "J53f512"
}
};
I aim to break down this data in order to present it using a layout similar to the one shown below in the thead/tbody of an html table.
https://i.sstatic.net/qpKBL.png
In order to achieve this, I need to:
- Create an array ['email', 'description', 'refNumber'] based on myObj data.
- Iterate through the object (Can we loop through an object?) and generate separate arrays like
['[email protected]', 'CLEAN THE HOUSE', 'J251525']
['[email protected]', 'BRUSH HORSE', 'J512912']
['[email protected]', 'WASH CAR', 'J53f512']
Starting this process is a bit challenging for me since typically when working with objects, I already know the keys without needing to iterate. In this case, I must determine how many objects are within the main object somehow. Furthermore, I cannot access data using myObj['J251525'] as I am unaware of the key J251525.
Please note that I am utilizing Typescript alongside Angular 2.