title: KendoUI DataSource results in Invalid JSON Primitive
body: <p>So I've been beating my head against the wall for a day or so trying to get this to work.  if it's simple and stupid - sorry and thanks.  It's pretty long post as I'm trying to describe everything I've done thus far.</p>
  
  <p>So I have a ASMX web service that I would like to use to populate a Kendo UI listview.  This works perfectly until I add the data: to my transport request.  So my web service looks like this now:</p>
  
  <pre><code>WebMethod(Description = "Return All Pending Actions Based")]
  [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
  public PendingActionResult GetPendingActions(string sUsername, string sPassword, string sUserID, string sClubID)
  {
     //code is here;
  }
  </code></pre>
  
  <p>And my full dataSource looks like this:</p>
  
  <pre><code>dataSource = new kendo.data.DataSource({
                  transport: {
                      read: {
                          type: "POST",
                          data:  "{'sUsername':'admin@mail.com','sPassword':'13123','sUserID':'1539','sClubID':'1'}",
                          url: "http://sdk.domain.com/services/general.asmx/GetPendingActions",
                          contentType: "application/json; charset=utf-8",
                          dataType: "json"
                      }
                  },
                  schema: {
                          data: "d.Data", // ASMX services return JSON in the following format { "d": &lt;result&gt; }. Specify how to get the result.
                          total: "d.Total",
                          model: {
                              id: "activityID",
                              fields: {
                                  activityID: { type: "number", validation: {min: 1, required: true } },
                                  taskName: { type: "string" },
                                  taskNote: { type: "string" },
                                  openDate: { type: "datetime" },
                                  dueDate: { type: "datetime" },
                                  priority: { type: "number" },
                                  statusID: { type: "number" },
                                  openedByID: { type: "number" },
                                  assignedToID: { type: "number" },
                                  statusName: { type: "string" },
                                  complete: { type: "bool" }
                              }
                          }
                      }
              });
  
              that.set("pendingActionsDataSource", dataSource);
  </code></pre>
  
  <p>The error I get back is:</p>
  
  <blockquote>
    <p>{"Message":"InvalidJSONprimitive:"\u00261={\u00262=\u0027\u00263=s\u00264=U\u00265=s\u00266=e\u00267=r\u00268=n\u00269=a\u002610=m\u002611=e\u002612=\u0027\u002613=:\u002614=\u0027\u002615=a\u002616=d\u002617=m\u002618=i\u002619=n\u002620=@\u002621=m\u002622=a\u002623=i\u002624=l\u002625=.\u002626=c\u002627=o\u002628=m\u002629=\u0027\u002630=,\u002631=\u0027\u002632=s\u002633=P\u002634=a\u002635=s\u002636=s\u002637=w\u002638=o\u002639=r\u002640=d\u002641=\u0027\u002642=:\u002643=\u0027\u002644=1\u002645=3\u002646=1\u002647=2\u002648=3\u002649=\u0027\u002650=,\u002651=\u0027\u002652=s\u002653=U\u002654=s\u002655=e\u002656=r\u002657=I\u002658=D\u002659=\u0027\u002660=:\u002661=\u0027\u002662=1\u002663=5\u002664=3\u002665=9\u002666=\u0027\u002667=,\u002668=\u0027\u002669=s\u002670=C\u002671=l\u002672=u\u002673=b\u002674=I\u002675=D\u002676=\u0027\u002677=:\u002678=\u0027\u002679=1\u002680=\u0027\u002681=}\u002682=".","StackTrace":"atSystem.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(Stringinput,Int32depthLimit,JavaScriptSerializerserializer)\r\natSystem.Web.Script.Serialization.JavaScriptSerializer.DeserializeT\r\natSystem.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContextcontext,WebServiceMethodDatamethodData)","ExceptionType":"System.ArgumentException"}</p>
  </blockquote>
  
  <p>So I started searching high and low for anything that was similar and found other people missing a ' or a " in the data request so I tried a ton of different variations of it, tried using JSON.stringify but the error continued.  So I went to fiddler to see what was being sent to the server and here is my problem.  Junk is being sent.  Fiddler shows this in TextView being sent to the server:</p>
  
  <pre><code>0=%7B&amp;1='&amp;2=s&amp;3=U&amp;4=s&amp;5=e&amp;6=r&amp;7=n&amp;8=a&amp;9=m&amp;10=e&amp;11='&amp;12=%3A&amp;13='&amp;14=a&amp;15=d&amp;16=m&amp;17=i&amp;18=n&amp;19=%40&amp;20=m&amp;21=a&amp;22=i&amp;23=l&amp;24=.&amp;25=c&amp;26=o&amp;27=m&amp;28='&amp;29=%2C&amp;30='&amp;31=s&amp;32=P&amp;33=a&amp;34=s&amp;35=s&amp;36=w&amp;37=o&amp;38=r&amp;39=d&amp;40='&amp;41=%3A&amp;42='&amp;43=1&amp;44=3&amp;45=1&amp;46=2&amp;47=3&amp;48='&amp;49=%2C&amp;50='&amp;51=s&amp;52=U&amp;53=s&amp;54=e&amp;55=r&amp;56=I&amp;57=D&amp;58='&amp;59=%3A&amp;60='&amp;61=1&amp;62=5&amp;63=3&amp;64=9&amp;65='&amp;66=%2C&amp;67='&amp;68=s&amp;69=C&amp;70=l&amp;71=u&amp;72=b&amp;73=I&amp;74=D&amp;75='&amp;76=%3A&amp;77='&amp;78=1&amp;79='&amp;80=%7D
  </code></pre>
  
  <p>(I'll post a picture online of this so it's a little easier to see)</p>
  
  <p>So here I can clearly see that the string isn't being sent in the correct format.  So I decided to give this a go without using Kendo dataSource but instead just use JSON/AJAX.  So I typed this up:</p>
  
  <pre><code>function getPAs() {
      $.ajax({
      type: "POST",
      url: "http://sdk.domain.com/services/general.asmx/GetPendingActions",
      data:  "{'sUsername':'admin@mail.com','sPassword':'13123','sUserID':'1539','sClubID':'1'}",
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: getPAs_Success,
      error: app.onError
      });
  }
  
  function getPAs_Success(data, status) {
      console.log("START getPAs_Success");
  
      var cars = data.d;
      var sout = document.getElementById('nav');
      var output = "";
      $.each(cars, function(index, car) {
      output += '&lt;p&gt;&lt;strong&gt;' + car.taskName + ' ' +
                              car.taskNote + '&lt;/strong&gt;&lt;br /&gt; Priority: ' +
                              car.priority + '&lt;br /&gt;Status: ' +
                              car.statusID + '&lt;br /&gt;Opened By: ' +
                              car.openedByID + '&lt;br /&gt;Assigned To' +
                              car.assignedToID + '&lt;/p&gt;';
      });
      sout.innerHTML = output;
      console.log("END getPAs_Success");
  }
  </code></pre>
  
  <p>And if I look at fiddler in TextView I see this being sent to the server:</p>
  
  <pre><code>{'sUsername':'admin@mail.com','sPassword':'13123','sUserID':'1539','sClubID':'1'}
  </code></pre>
  
  <p>And I clearly see my JSON results in fiddler as well.</p>
  
  <p>So my question is after all of that:</p>
  
  <p>Is there something special I need to be doing with the Kendo UI Datasource in order to pull this off?  If it matters, I'm using Icenium and trying to build a quick mobile app for fun.</p>
  
  <p>Thanks,</p>
  
  <p>Richard</p>
  
  <p>UPDATE #1
  Tried both and no further.</p>
  
  <p>data: {"sUsername":"admin@mail.com","sPassword":"13123","sUserID":"1539","sClubID":"1"},</p>
  
  <p>which validates using jsonlint.com but when I look at fiddler now I see this being sent to the server:</p>
  
  <p>sUsername=admin%40mail.com&amp;sPassword=13123&amp;sUserID=1539&amp;sClubID=1</p>
  
  <p>So maybe it's because I don't have quotes around the data now so I tried this:</p>
  
  <p>data: '{"sUsername":"admin@mail.com","sPassword":"13123","sUserID":"1539","sClubID":"1"}',</p>
  
  <p>and when I do that I get same mess of 0=%7... like above.  </p>
  
  <p>When I try to use toJSON I get an object function has no method.  Doing something like this:</p>
  
  <pre><code>var jsPost = $.toJSON({
                  sUsername: "admin@mail.com",
                  sPassword: "13123",
                  sUserID: "1539",
                  sClubID: "1"
              });
  </code></pre>
  
  <p>Found someone on the telerik forums which said not to use toJSON and instead use JSON.stringify so I tried this:</p>
  
  <pre><code>var jsPost = {
                  sUsername: "admin@mail.com",
                  sPassword: "13123",
                  sUserID: "1539",
                  sClubID: "1"
              };
  </code></pre>
  
  <p>...</p>
  
  <pre><code>data: JSON.stringify(jsPost),
  </code></pre>
  
  <p>But still results in the crazy garbage.</p>