In the dictionary provided below, I am looking to determine the total length of all notifications (4).
[
{
"name": "3 Bedroom Fixer Upper",
"city": "Santa Rosa",
"id": 1,
"state": "CA",
"date_added": "2/3/14",
"completion_status": "20",
"notifications": [
"Quarterly Checklist",
"Pre-Summer",
"Annual Checklist"
],
"sq_ft": 2200,
"year_built": 1994,
"bedrooms": 3,
"bathrooms": 2.5,
"lot_size": 2.5
},
{
"name": "Ski Cabin",
"city": "Tahoe",
"id": 2,
"state": "CA",
"date_added": "3/3/14",
"completion_status": "45",
"notifications": [
"Quarterly Checklist"
],
"sq_ft": 1950,
"year_built": 1984,
"bedrooms": 3.5,
"bathrooms": 2,
"lot_size": 3
}
];
I have successfully retrieved the length of notifications for a single object (for example: all_properties[0].notifications.length = 3), but accessing the length of all notifications by using all_properties.notifications.length does not provide any result. What would be the correct syntax to get the length of all notifications? (4)
http://jsfiddle.net/dakra/U3pVM/
Apologies if my terminology related to JSON dictionaries is incorrect as I am new to this concept.