jQuery DataTables: Associative array

HTML

<link rel="stylesheet" href="https://cdn.datatables.net/r/dt/dt-1.10.9/datatables.min.css">
<script src="https://cdn.datatables.net/r/dt/dt-1.10.9/datatables.min.js"></script>
<h3>jQuery DataTables: Associative array</h3>
<a href="https://www.gyrocode.com/articles/tag/jquery-datatables/">See more articles about jQuery DataTables</a> on <a href="https://www.gyrocode.com/articles/">Gyrocode.com</a><hr>

<table id="example" class="display" cellspacing="0" width="100%">
    <thead>
        <tr>
            <th>Name</th>
            <th>Value</th>
        </tr>
    </thead>
    <tfoot>
        <tr>
            <th>Name</th>
            <th>Value</th>
        </tr>
    </tfoot>
</table>

<hr><a href="https://www.gyrocode.com/articles/tag/jquery-datatables/">See more articles about jQuery DataTables</a> on <a href="https://www.gyrocode.com/articles/">Gyrocode.com</a>

JavaScript

$(document).ready(function (){
    var data = {
       'property1': 'value1',
       'property2': 'value2'      
    };
    
    var dataArray = [];
    for(var name in data){
       if(data.hasOwnProperty(name)){ dataArray.push([name, data[name]]); }
    }
    
    var table = $('#example').DataTable({
        data: dataArray
    });
});