This is a migrated thread and some comments may be shown as answers.

JSON DataSource Model

3 Answers 164 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 18 Aug 2016, 04:56 PM

Example: http://jsfiddle.net/rqqw5v7x/

How does one grab just the data within the "Customers:" array from JSON?

Abridged version of what comes from http://northwind.servicestack.net/customers.json :

 

{"Customers":[
{"Id":"ALFKI","CompanyName":"Alfreds Futterkiste","ContactName":"Maria Anders","ContactTitle":"Sales Representative","Address":"Obere Str. 57","City":"Berlin","PostalCode":"12209","Country":"Germany","Phone":"030-0074321","Fax":"030-0076545"},
{"Id":"ANATR","CompanyName":"Ana Trujillo Emparedados y helados","ContactName":"Ana Trujillo","ContactTitle":"Owner","Address":"Avda. de la Constitución 2222","City":"México D.F.","PostalCode":"05021","Country":"Mexico","Phone":"(5) 555-4729","Fax":"(5) 555-3745"}
"}],"ResponseStatus": {}}

 

3 Answers, 1 is accepted

Sort by
0
Accepted
Patrick | Senior Technical Support Engineer
Telerik team
answered on 18 Aug 2016, 07:41 PM
Hi Chris,

In order to get Customers from the Json, you must add the schema.data configuration. 
Here is a snippet:
var dsCustomer = new kendo.data.DataSource({
            transport: {
                read: {
                    url: "http://northwind.servicestack.net/customers.json",
                    dataType: "json"
                }
            },
            schema: {
                data: "Customers",
                ...
            }
        });

Please take a look at this Kendo UI Dojo by Progress which uses that dataSource in a Kendo Grid.  

I hope this helps!

Regards,
Patrick
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
0
Chris
Top achievements
Rank 1
answered on 30 Sep 2016, 02:05 PM

[quote]I hope this helps![/quote]

It does help. Thank you!

0
Patrick | Senior Technical Support Engineer
Telerik team
answered on 30 Sep 2016, 02:29 PM
Hi Chris,

Glad everything is working well!

Regards,
Patrick
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
Data Source
Asked by
Chris
Top achievements
Rank 1
Answers by
Patrick | Senior Technical Support Engineer
Telerik team
Chris
Top achievements
Rank 1
Share this question
or