title: How to insert a row in Javascript with a loop?
body: <p>I have a json file and I want to convert the data into a table with Javascript. I found some similar questions <a href="https://stackoverflow.com/questions/9927126/how-to-convert-the-following-table-to-json-with-javascript">How to convert the following table to JSON with javascript?</a> , <a href="https://stackoverflow.com/questions/48785804/loop-through-a-json-object">loop through a json object</a>, but they all use jQuery and show the table on html web. I just need a simple loop to insert row into the table. I tried 'append', 'insert' and 'insertRow', all not work. Could anyone give me a hint?</p>
  
  <p>Json file:</p>
  
  <pre><code>{
  "name": "lily",
  "country": "china",
  "age": 23
  },
  {
  "name": "mike",
  "country": "japan",
  "age": 22
  },
  {
  "name": "lucy",
  "country": "korea",
  "age": 25
   }
  </code></pre>
  
  <p>My code:   </p>
  
  <pre><code>    var jdata = {};
      jdata.cols = [
          {
              "id": "1",
              "label": "name",
              "type": "string"
          },
          {
              "id": "2",
              "label": "country",
              "type":"string"
          }
      ];
  
      for(var i = 1; i &lt; 3; i++){
          row = [
              {
                  "c": [
                      {
                        "v": json["hits"]["hits"][i]["_source"]["name"]         
                      },
                      {
                         "v": json["hits"]["hits"][i]["_source"]["country"]
                      }
                  ]
              }
          ];
          jdata.rows.insertRow(row);
      }
  </code></pre>
  
  <p>Edit: Add expected output: change the json file to the following structure.</p>
  
  <pre><code>[
      ['lily', 'china'],
      ['mike', 'japan'],
      ['lucy', 'korea'], 
    ]
  </code></pre>