For complex JSON structures, you can use schema.parse
var grid = $("#grid").kendoGrid({ dataSource : { data : [ { "oneType": [ {"id": 1, "name": "John Doe"}, {"id": 2, "name": "Don Joeh"} ] }, {"othertype": "working"}, {"otherstuff": "xyz"} ], pageSize: 10, schema : { parse : function(d) { for (var i = 0; i < d.length; i++) { if (d[i].oneType) { return d[i].oneType; } } return []; } } } }).data("kendoGrid");
If you slightly change your JSON to:
{ "oneType" : [ {"id": 1, "name": "John Doe"}, {"id": 2, "name": "Don Joeh"} ], "othertype" : "working", "otherstuff": "xyz" }
then you can use:
var grid = $("#grid").kendoGrid({ dataSource: { data : { "oneType" : [ {"id": 1, "name": "John Doe"}, {"id": 2, "name": "Don Joeh"} ], "othertype" : "working", "otherstuff": "xyz" }, pageSize: 10, schema : { data: "oneType" } } }).data("kendoGrid");
source share