As a newcomer to Firebase and noSQL databases, I'm encountering difficulties in extracting all the JSON data from the database. Although I've gone through the firecast tutorials and understand how to retrieve specific values by referencing the database, my goal now is to programmatically extract all the JSON data from Firebase. When I attempt to export the JSON from my Firebase database, it contains the information I require, but how can I achieve this using the API? In the code snippet below, I tried referencing all children and displaying them within a pre tag, but nothing appears:
const ref = firebase.database().ref().child();
ref.on('value', snap => {
const yo = document.getElementById('test');
yo.innerText = JSON.stringify(snap.val());
});
Edit: The solution provided below is actually correct; there were errors present in my datatable code preventing the JavaScript from functioning properly.