So this is how the JSON looks like:
{
"notes" : {
"1DirZQovvSQjURmLH6FmSEIAeE52" : {
"1529ee5f-7a45-40fc-ab11-740d1188e122" : {
"color" : -2937041,
"description" : "{\"note\":[{\"format\":\"HEADING\",\"text\":\"Jjk\"},{\"format\":\"TEXT\",\"text\":\"Z\"}]}",
"folder" : "",
"locked" : false,
"pinned" : false,
"state" : "TRASH",
"tags" : "",
"timestamp" : 1538123875034,
"updateTimestamp" : 1538141384917,
"uuid" : "1529ee5f-7a45-40fc-ab11-740d1188e122"
},
"7e11bb9b-d912-424f-b7c5-5e1d7124f5c8" : {
"color" : -2937041,
"description" : "{\"note\":[{\"format\":\"HEADING\",\"text\":\"Vhj\"}]}",
"folder" : "",
"locked" : false,
"pinned" : false,
"state" : "TRASH",
"tags" : "",
"timestamp" : 1538123812453,
"updateTimestamp" : 1538141387318,
"uuid" : "7e11bb9b-d912-424f-b7c5-5e1d7124f5c8"
}
}
}
}
I am new to js. In Java, I could create separate JSONObject for each.
I did check other answers but they show how to iterate like this: snapshot.val()['notes']['1DirZQovvSQjURmLH6FmSEIAeE52']['1529ee5f-7a45-40fc-ab11-740d1188e122']['color']
but this so much hard coding.
How do I retrieve all the key-value pairs using indices or something like that instead of calling by key?
eg:
snapshot.val()[0][0][0][2]
Edit: added another json object for clarity