I took your fiddler from the other question and made a change based on that new question.
$(document).ready(function() {
var json = '[ { "Nome": "Felipe", "Data": "null", "Tipo": "Normal", "RG": "123456798"}, { "Nome": "Felipe2", "Data": "null", "Tipo": "Normal", "RG": "123456798"}, { "Nome": "Felipe3", "Data": "null", "Tipo": "Normal", "RG": "123456798"}]';
var column_names = []; //Array com confi das colunas
var jsonObj = JSON.parse(json); //Parse no obj json, facilita o manuseio
//Verifica se tem registro, para nao caga tudo
if(jsonObj.length>0){
//Monta array de colunas
$.each(Object.keys(jsonObj[0]),function(idx,obj){
column_names.push({"sTitle": obj, "mData":obj});
});
$('.table').DataTable({
"aaData": jsonObj,
"aoColumns":column_names
});
}
});
See if it helps you
I updated your question with dynamic column generation.