title: Rails putting JSON Data into HTML table
body: <p>Sorry this could be a real newbie question, but in my Rails 5 app I am trying to parse some JSON and display it into my view as a HTML table.  I tried using <a href="https://datatables.net/" rel="nofollow noreferrer">https://datatables.net/</a> but couldn't get it to work, might be worth another post.</p>
  
  <p>So I thought I show what I am doing and ask what is the better way as what I am doing seems really bad.</p>
  
  <p>JSON thats stored as @hosted_zones:</p>
  
  <pre><code>{
    "hosted_zones": [{
      "id": "/hostedzone/Z1HSDGASSSME",
      "name": "stagephil.com.",
      "caller_reference": "2016-07-12T15:33:45.277646707+01:00",
      "config": {
        "comment": "Private DNS zone for stage",
        "private_zone": true
      },
      "resource_record_set_count": 10
    }, {
      "id": "/hostedzone/ZJDGASSS0ZN3",
      "name": "stagephil.com.",
      "caller_reference": "2016-07-12T15:33:41.290143511+01:00",
      "config": {
        "comment": "Public DNS zone for stage",
        "private_zone": false
      },
      "resource_record_set_count": 7
    }],
    "is_truncated": false,
    "max_items": 100
  }
  </code></pre>
  
  <p>Now my View:</p>
  
  <pre><code>&lt;table&gt;
          &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th&gt;ID&lt;/th&gt;
                  &lt;th&gt;Name&lt;/th&gt;
                  &lt;th&gt;Caller Reference&lt;/th&gt;
                  &lt;th&gt;Comment&lt;/th&gt;
                  &lt;th&gt;private_zone&lt;/th&gt;
                  &lt;th&gt;Resource Record Set Count&lt;/th&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;% stop = @hosted_zones['hosted_zones'].count %&gt;&lt;% start = 0 %&gt;
          &lt;% while start &lt; stop do %&gt;
            &lt;tr&gt;
              &lt;td&gt;&lt;%= @hosted_zones['hosted_zones'][start]["id"]%&gt;&lt;/td&gt;
              &lt;td&gt;&lt;%= @hosted_zones['hosted_zones'][start]["name"]%&gt;&lt;/td&gt;
              &lt;td&gt;&lt;%= @hosted_zones['hosted_zones'][start]["caller_reference"]%&gt;&lt;/td&gt;
              &lt;td&gt;&lt;%= @hosted_zones['hosted_zones'][start]["config"]["comment"]%&gt;&lt;/td&gt;
              &lt;td&gt;&lt;%= @hosted_zones['hosted_zones'][start]["config"]["private_zone"]%&gt;&lt;/td&gt;
              &lt;td&gt;&lt;%= @hosted_zones['hosted_zones'][start]["resource_record_set_count"]%&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;% start += 1 %&gt;
          &lt;% end %&gt;
      &lt;/table&gt;
  </code></pre>
  
  <p>Surely there is a better way, as this seems really slow and when I get to production which has 400+ records thats never going to load.</p>
  
  <p>Any suggestions?</p>