title: Output JSON key, value in JavaScript
body: <p>I have a json file with content in this format:</p>
  
  <pre><code>{
    "Florida":{
     "4079823456" : "Text message content 1 here",
     "4079323457" : "Text message content 2 here",
     "4079823458" : "Text message content 3 here"
  },
  
  "Texas":{
     "2149823456" : "Text message content 1 here",
     "2149323457" : "Text message content 2 here",
     "2149823458" : "Text message content 3 here"
  }
  
  }
  </code></pre>
  
  <p>I am using javascript (no libraries) to output the key/value pairs in the json file to an html table to get an output like this:</p>
  
  <pre><code>Phone Number | Text Message
  4079823456   | Text message content 1 here
  4079323457   | Text message content 2 here
  </code></pre>
  
  <p>But instead, I get something like this:</p>
  
  <pre><code>  Phone Number | Text Message
        0            {
        1            "
  </code></pre>
  
  <p>The following is a code snippet from my javascript:</p>
  
  <pre><code>var str = JSON.stringify(http_request.responseText);
  var obj = JSON.parse(str);
  var rowContent;
  
  var tablerows = document.getElementById("tablerow");
  
  for(var key in obj){
     rowContent = "&lt;tr&gt;&lt;td&gt;" + key + "&lt;/td&gt;&lt;td&gt;" + obj[key] + "&lt;/td&gt;&lt;/tr&gt;";
  
     tablerows.innerHTML += rowContent;
  }
  </code></pre>
  
  <p>How can I get the key value pairs to output to the desired output instead of getting each individual character in my JSON file? Ideally, I would like to loop through both the key and the value (in my case, the phone numbers and text messages) as there are actually hundreds of them.</p>
  
  <p>Thanks in advance.</p>