title: Parsing JSON object from Firebase and using key value pairs to generate content
body: <p>I have set up a database with Firebase and I have populated it with JSON information. I have code, taken directly from the Firebase documentation, that takes a snapshot of my data and updates it in real time. This is great for what I need, but I also need to access the values in my JSON to generate lists of content similarly to this:</p>
  
  <pre><code>var JSONStuff = json info on database
  for (every array in the JSON)
  {
    //MAKE THINGS
  } 
  </code></pre>
  
  <p>I usually do this with php scripts and SQL databases, but I am using Firebase for the first time and I am not sure what I am doing wrong. Here is what I have so far.</p>
  
  <p>JavaScript:</p>
  
  <pre><code>var display = document.getElementById("resultsDisplay");
  var dbRef = firebase.database().ref().child("workouts");
  // Sync with Firebase in real time.
  dbRef.on("value", snap =&gt;
  {
    //display.innerHTML = JSON.stringify(snap.val(), null, 3); This correctly prints my JSON.
    JSON.stringify(snap.val(), null, 3);
  });
  
  JSON.parse(dbRef) //Trying to parse the JSON and do things with it.
  {
    for (var i = 0, len = dbRef.length; i &lt; len; i++)
    {
      display.innerHTML = 'Routine: ' + dbRef.title + ' Exercises: ' + dbRef.name + '.';
    }
  };
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div id="resultsDisplay"&gt;boo&lt;/div&gt;
  </code></pre>
  
  <p>The console gives me the "Uncaught SyntaxError: Unexpected token h in JSON" error, which I know means there are double quotes messing with my parser somewhere, but as you can see I am not using them in the function.</p>
  
  <p>I am a noob and therefore probably doing something completely silly, but any help would be greatly appreciated.</p>