parsing JSON from DataDirect OData

2 posts, 0 answers
  1. Drew
    Drew avatar
    3 posts
    Member since:
    Nov 2015

    Posted 09 Aug Link to this post

    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"
    }
    }

  2. Drew
    Drew avatar
    3 posts
    Member since:
    Nov 2015

    Posted 10 Aug Link to this post

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

     

     

    Du'h.

  3. Kendo UI is VS 2017 Ready
Back to Top