dojo.xhr.get({ url:"REST.xsp/People", handleAs:"json", load: function(data){ var output = '<table>'; // Build the header row by inspecting column names output += '<tr>'; for (var col in data[0]) { output += '<th>' + col + '</th>'; } output += '</tr>'; // Build the data rows for(var i in data){ output += '<tr>'; for (col in data[i]) { output += '<td>' + data[i][col] + '</td>'; } output += '</tr>'; } output += '</table>'; dojo.byId('resultsDiv').innerHTML = output; }, error: function(msg, args) { dojo.style('resultsDiv', 'color', 'red'); dojo.byId('resultsDiv').innerHTML = 'Status: ' + args.xhr.status + '<br />' + msg; } });