 <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code> var input = { "firstname": "John", "lastname": "Doe", "numbers": [{ "id": 1, "value": "123" }, { "id": 2, "value": "123" }] } for (var key in input) { if (key === "numbers") { for (var i=0; i &lt; input[key].length; i++) { console.log(input[key][i]); } } else { console.log(key + ":" + input[key]) } }</code></pre> </div> </div> </p>