JSON parse/load data error

Hi team,
I spent 2 days trying to fix this problem, and searched in this forum many times but couldn’t find an answer.

I am creating/ returning a JSON from my controller as the following:

private JsonResult GetCustomers()
var customers = from s in db.Customers
select s;

        var retValue = customers.Select(
            x => new
                id = x.CustomerId,
                fname = x.First_Name,
                lname= x.Last_Name

        JavaScriptSerializer serializer = new JavaScriptSerializer();
        return Json(new { Data = serializer.Serialize(retValue) }, JsonRequestBehavior.AllowGet);

the returned JSON is:
{“Data”:{“ContentEncoding”:null,“ContentType”:null,“Data”:{“Data”:"[{“id”:14,“fname”:“Sim”,“lname”:“Yoak”},{“id”:15,“fname”:“Cheel”,“lname”:“Pink”},{“id”:16,“fname”:“Pa Poon”,“lname”:“Chok”},“JsonRequestBehavior”:0,“MaxJsonLength”:null,“RecursionLimit”:null}}

on the view i have:

mygrid.load("/Home/GetCustomers", “jsarray”);

I also tried : mygrid.load("/Home/GetCustomers", “js”); and no luck

Am i missing something here? all i need is to load the data from my model to the Grid

jsArray expects the data to look like this:

   [ ['row1 col1', 'row1 col2', 'row1 col2'], ['row2 col1', 'row2 col2', 'row2 col2'] ]

This is an array of comma separated columns.

Here’s a sample: dhtmlx.com/docs/products/dhtmlxG … array.html

If you use chrome and inspect element, then go to the network tab - refresh the page and look at the response of data.js.

If you want to use pure json, it has a different data format and there are json samples you can find. Whatever format you use, make sure it is formatted exactly as dhtmlx is expecting.

I have found that using the pure json format is better because you can set an id for each column (this is also possible in xml).

Correction of last sentence:

I have found that using the pure json format is better because you can set an id for each ROW (this is also possible in xml).

Thanks for the reply, but how can i format the JSON file i created to meet the Grid requirements?

Is there a way to use the connector in this case? if so how can i integrate The connector with my MVC application.

Unfortunately it’s not available to generate the json using the dhtmlxConnector.