title: How to access nested JSON in JS?
body: <p>So I have this JSON struture that I have successfully passed into JS:</p>
  
  <pre><code>{
  "StepOne": [
      {
          "id": "2",
          "type": "1",
          "description": "How are you feeling?",
          "options": [
              {
                  "opt_id": "1",
                  "opt_desc": "Good"
              },
              {
                  "opt_id": "2",
                  "opt_desc": "Perfect"
              },
              .... etc
  </code></pre>
  
  <p>It goes on until PageFive and the amount of questions vary from 1-4 in each step and the options vary from null to about 10 for each question. I want to use this information to generate a multi step form in Javascript, but I can not figure out how to access the inner data. I can only find "PageOne", "PageTwo" etc. I am using this following code to do that:</p>
  
  <pre><code>$(document).ready(function()
      {       
          $('#show-results').click(function() 
          {
              $.post('json.php', function(data) 
              {
                  var pushedData = jQuery.parseJSON(data);
  
  
                  $.each(pushedData, function(i, serverData)
                  {
                      alert(i);
                  })
              })
          })
      });
  </code></pre>
  
  <p>Now I have tried these functions to get to the inner values:</p>
  
  <pre><code>var desc = pushedData.PageOne.description;
  
  var desc = pushedData['PageOne']['Description'];
  </code></pre>
  
  <p>And inside the each loop I've tried stuff like</p>
  
  <pre><code>var desc = PageOne.description;
  
  var desc = PageOne['description'];
  </code></pre>
  
  <p>It all comes out as <em>undefined.</em> Is there a way to iterate through each of the questions in each Page the same way I have done to iterate through the pages? And from there rinse and repeat to iterate through the options for each question? If I could access each level I should be all set for generating a poll dynamically which is the ultimate goal here.</p>
  
  <p>I think this code is on to something (found out right after I posted). Not quite working though.</p>
  
  <pre><code>$(document).ready(function()
      {       
          $('#show-results').click(function() 
          {
              $.post('JSAAN.php', function(data) 
              {
                  var pushedData = jQuery.parseJSON(data);
  
                  $.each(pushedData, function(i, stepData)
                  {
                      $.each(stepData, function(j, questionData)
                      {
                        // Print question here
                             $.each(questionData, function(k, optionData)
                             {
                                  // Print option here
                             })
  
                      })
                  })
              })
          })
      });
  </code></pre>