Within my Calendar, there is a code snippet that includes an Object and JSON data. This JSON object contains various properties such as
[{"Date":"17-3-2015","Event":"Test drive","Participants":"John, George","Description":"Testing a new F30"},
{"Date":"17-3-2015","Event":"Football match","Participants":"FCSM vs FCKK","Description":"New season start"},
{"Date":"25-3-2015","Event":"Jane's Birthday","Participants":"Jane, John, Richard, Alice","Description":"Celebration with my friends"}]
The data is stored in localStorage, so I retrieved it using this code:
var existEvents = JSON.parse(localStorage.getItem('events'));
for(i=0; i<existEvents.length; i++) {
var item = localStorage.getItem(localStorage.key(i));
console.log(item);
};
existEvents
holds all the new events from my Calendar
console.log(item);
displays the data mentioned above.
My goal is to extract every Date value (= key) from the data. I tried using
item.Date
believing it would work, but unfortunately, it doesn't. I also attempted
item[0].value
I experimented after reviewing this question + answers Access / process (nested) objects, arrays or JSON
What am I missing here? Any assistance is appreciated!