This is my firebase database.
When I export the JSON of this database it gives me the following JSON data:-
{
"app1": {
"app-icon": "some-icon",
"app-name": "AmazingApp",
"feature-id": 1,
"image-list": {
"image1": {
"image-display-time": 20,
"image-name": "Name",
"image-sequence": 1,
"music-file": "some mp3 file"
},
"image2": {
"image-display-time": 25,
"image-name": "Name",
"image-sequence": 2,
"music-file": "some mp3 file"
}
},
"image-time-enabled": false
}
}
Here image-list is a array but from what I know firebase does not support arrays, hence there are no [ ] which denotes a array. So if I give this JSON data to any third party to consume they are not able to consume this data since they cannot loop over the children of the node image-list as it is technically not an array(though it is meant to be a array).
How do I get to work with such a JSON data?
NOTE : The third party uses javascript and won't be accessing the firebase database directly instead they would just consume json coming from a plain text.
They can use the for-in loop like below to get the objects.
for (var key in image-list) {
if (image-list.hasOwnProperty(key)) {
console.log(key + " -> " + JSON.stringify(image-list[key]));
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With