How to access JSON nested objects with ruby? : <p>so I have a JSON file that is made of nested objects that follow the following pattern : <code>parent -&gt; child -&gt; grand_child</code> and looks like the following : </p>

<pre><code>//seed.json
    {
      "parent_0":[
        {
          "child_10":[
            {
              "grand_child_A":[],
              "grand_child_B":[],
              "grand_child_C":[]
            }
          ],
          "child_20":[],
          "child_30":[],
          "child_40":[]
        }
      ],

      "parent_1":[
        {
          "child_11":[
            {
              "grand_child_D":[],
              "grand_child_E":[],
              "grand_child_F":[]
            }
          ]
        }
      ]
    }
</code></pre>

<p>What I am trying to do is to list all objects present in parents , child and grand_child with ruby.</p>

<p>I was able to pull that off with <code>parent</code> by doing the following :</p>

<pre><code># seed.json

json = File.read('seed.json')
content = JSON.parse(json).keys
</code></pre>

<p>which return the following : </p>

<pre><code>$ ruby seed.rb
"parent_0"
"parent_1"
$ 
</code></pre>

<p>I'm stuck there ... I'd like to access <code>child_10</code> and list all its objects which are <code>grand_child_A</code>, <code>grand_child_B</code>, <code>grand_child_C</code>, the same way I did access and list <code>parent_0 and parent_1</code> but I have no idea how to proceed.</p>

<p>Any idea ?</p>
