How can I print values of nested objects of JSON string?
<p>I have the following JSON response after an <code>XMLHttpRequest</code>: </p>

<pre><code>{
    "success":true,
    "result":{"1":{"id":"1","question":"What is one + two","answer":"three"},
              "2":{"id":"2","question":"two + four","answer":"six"},
              "3":{"id":"3","question":"one + three","answer":"for"}
             }
}
</code></pre>

<p>I want to display all the questions in a bulleted list and all the answers in a bulleted list side-by-side. Right now I have the following (I included this <a href="https://github.com/douglascrockford/JSON-js/blob/master/json2.js" rel="nofollow">code</a> to add the <code>JSON.parse</code> functionality, should work):</p>

<pre><code>&lt;script type="text/javascript" src="json2.js"&gt;&lt;/script&gt;
// ...
var response = JSON.parse(xhr.requestText);  
var list = document.getElementById('listQuestions');
for (var i = 0 ; i &lt; response.length; i++){
    list.innerHTML += '&lt;li&gt;' + response[i].question + '&lt;/li&gt;';  // I'm certain this is wrong--I also tried the following but it's not what I'm looking for:

// for (var key in response) {
// console.log("Key: "+key+" value: "+response[key]);
// }
}

// ...
&lt;/script&gt;
</code></pre>