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

parsing JSON from DataDirect OData

1 Answer 77 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Drew
Top achievements
Rank 1
Drew asked on 09 Aug 2016, 04:58 PM

I'm attempting to connect an OData datasource from Datadirect's on-premise MS SQL connector to KendoUI instances.  I can successfully get a response, but the format of the response seems to be throwing errors for Javascript/Kendo UI. "Uncaught SyntaxError: Unexpected token : " with reference to the URL for the JSON response from Datadirect's connector.

 

I suspect I need to configure the schema for the datasource to parse beyond the "d" : , but have been unsuccessful so far.  There are 2 records in the JSON response below that I am trying to populate to a Kendo UI grid.

{
"d" : {
"results" : [
{
"__metadata" : {
"uri" : "https://place.ontheinternet.com/api/odata/data/table", "type" : "mspsql3.Users"
}, "UserID" : 1, "Username" : "host", "FirstName" : "SuperUser", "LastName" : "Account", "IsSuperUser" : true, "AffiliateId" : null, "Email" : "hjghjg@gvghtrdt.com", "DisplayName" : "SuperUser Account", "UpdatePassword" : false, "LastIPAddress" : null, "IsDeleted" : false, "CreatedByUserID" : -1, "CreatedOnDate" : "\/Date(1365162224930)\/", "LastModifiedByUserID" : 245, "LastModifiedOnDate" : "\/Date(1440941627913)\/", "PasswordResetToken" : "00000000-0000-0000-0000-000000000000", "PasswordResetExpiration" : null
}, {
"__metadata" : {
"uri" : "https://place.ontheinternet.com/api/odata/data/table", "type" : "mspsql3.Users"
}, "UserID" : 2, "Username" : "drew", "FirstName" : "Drew", "LastName" : "SK", "IsSuperUser" : true, "AffiliateId" : null, "Email" : "fdjk@fjkndnj.com", "DisplayName" : "DrewSK", "UpdatePassword" : false, "LastIPAddress" : "127.0.0.1", "IsDeleted" : false, "CreatedByUserID" : 1, "CreatedOnDate" : "\/Date(1365176462207)\/", "LastModifiedByUserID" : -1, "LastModifiedOnDate" : "\/Date(1366149209000)\/", "PasswordResetToken" : null, "PasswordResetExpiration" : null
}
], "__count" : "495"
}
}

1 Answer, 1 is accepted

Sort by
0
Drew
Top achievements
Rank 1
answered on 10 Aug 2016, 04:32 PM

Nevermind - solved it - I was using dataType: "jsonp" instead of json.

 

 

Du'h.

Tags
Data Source
Asked by
Drew
Top achievements
Rank 1
Answers by
Drew
Top achievements
Rank 1
Share this question
or