How to access nested JSON object key and values
<p>I am trying to access the key and values of my nested array like this:</p>

<pre><code>var obj = $.getJSON("mydata.json", function() {
    console.log( "load success" );
});

Object.keys(obj[2].type).forEach(function(key) {
    console.log(key, obj[key]);
});
</code></pre>

<p>But I get an error.</p>

<p>Here's the structure of the JSON file:</p>

<pre><code>{
"nodes": [
    {
        "nd": "nd1",
        "cat": "cat1"
    }
],
"links": [
    {
        "id": 100
    }
],
"types": [
            {
                "type": "one",
                "image": "image001"
            },
            {
                "type": "two",
                "image": "image002"
            },
            {
                "type": "three",
                "image": "image003"
            }
        ]   
</code></pre>

<p>}</p>

<p>My goal is to get a list of values of:</p>

<blockquote>
  <p>one two three</p>
</blockquote>