title: How to map json object data to datatables using Jquery
body: <p>I have a JSON object data that am getting from an api call. How can I map it to two columns.
  This is the JSON Object</p>
  <pre><code>[
      {
          &quot;id&quot;: 322,
          &quot;uploadStatus&quot;: 0,
          &quot;labName&quot;: &quot;CS Minhewene&quot;
      },
      {
          &quot;id&quot;: 323,
          &quot;uploadStatus&quot;: 0,
          &quot;labName&quot;: &quot;CS Nacuale&quot;
      },
      {
          &quot;id&quot;: 324,
          &quot;uploadStatus&quot;: 0,
          &quot;labName&quot;: &quot;CS Mesa&quot;
      },
      {
          &quot;id&quot;: 325,
          &quot;uploadStatus&quot;: 0,
          &quot;labName&quot;: &quot;CS Metoro&quot;
      },
      {
          &quot;id&quot;: 326,
          &quot;uploadStatus&quot;: 0,
          &quot;labName&quot;: &quot;CS Ngewe&quot;
      },
      {
          &quot;id&quot;: 327,
          &quot;uploadStatus&quot;: 0,
          &quot;labName&quot;: &quot;CS Mariri&quot;
      }
  ]
  </code></pre>
  <p>Whenever I try to map it I get a datatable error</p>
  <blockquote>
  <p>DataTables warning: table id=tableBody - Requested unknown parameter
  '0' for row 0, column 0. For more information about this error, please
  see <a href="http://datatables.net/tn/4" rel="nofollow noreferrer">http://datatables.net/tn/4</a></p>
  </blockquote>
  <p>This is my implementation</p>
  <pre><code>$.ajax({
                              type: 'GET',
                              contentType: &quot;application/json; charset=utf-8&quot;,
                              url: 'api/getuploadbydistricts/'+this.name,
                              success: function (data) {
                                  myJsonData = data;
                                  console.log('data 2', myJsonData);
                                  populateDataTable(JSON.stringify(myJsonData));
                                  $('#tableBody').dataTable().fnDestroy();
                                  },
                                   error: function (e) {
                                      console.log(&quot;There was an error with your request...&quot;);
                                      console.log(&quot;error: &quot; + JSON.stringify(e));
                                      }
                                      });
                                      // populate the data table with JSON data
                                      function populateDataTable(data) {
                                          console.log(&quot;populating data table...&quot;);
                                          console.log('data 2', data.uploadStatus);
                                          $('#tableBody').dataTable().fnDestroy();
                                          $(&quot;#tableBody&quot;).DataTable().clear();
                                          $('#tableBody').dataTable().fnAddData( [
                                          data.uploadStatus,
                                          data.labName,
                                          ]);
                                          // clear the table before populating it with more data
                                      }
  </code></pre>
  <p>How can I display the json object to the datatable correctly, an help is appreciated</p>