title: Jquery Ajax Posting JSON to webservice
body: <p>I am trying to post a JSON object to a asp.net webservice.</p>
  <p>My json looks like this:</p>
  <pre><code>var markers = { &quot;markers&quot;: [
    { &quot;position&quot;: &quot;128.3657142857143&quot;, &quot;markerPosition&quot;: &quot;7&quot; },
    { &quot;position&quot;: &quot;235.1944023323615&quot;, &quot;markerPosition&quot;: &quot;19&quot; },
    { &quot;position&quot;: &quot;42.5978231292517&quot;, &quot;markerPosition&quot;: &quot;-3&quot; }
  ]};
  </code></pre>
  <p>I am using the json2.js to stringyfy my JSON object.</p>
  <p>and I am using jquery to post it to my webservice.</p>
  <pre><code>  $.ajax({
          type: &quot;POST&quot;,
          url: &quot;/webservices/PodcastService.asmx/CreateMarkers&quot;,
          data: markers,
          contentType: &quot;application/json; charset=utf-8&quot;,
          dataType: &quot;json&quot;,
          success: function(data){alert(data);},
          failure: function(errMsg) {
              alert(errMsg);
          }
    });
  </code></pre>
  <p>I am getting the following error:</p>
  <blockquote>
  <p>Invalid JSON primitive</p>
  </blockquote>
  <p>I have found a bunch of posts relating to this and it seems to be a really common problem but nothing i try fixes the issue.</p>
  <p>When firebug what is being posted to the server it looks like this:</p>
  <blockquote>
  <p>markers%5B0%5D%5Bposition%5D=128.3657142857143&amp;markers%5B0%5D%5BmarkerPosition%5D=7&amp;markers%5B1%5D%5Bposition%5D=235.1944023323615&amp;markers%5B1%5D%5BmarkerPosition%5D=19&amp;markers%5B2%5D%5Bposition%5D=42.5978231292517&amp;markers%5B2%5D%5BmarkerPosition%5D=-3</p>
  </blockquote>
  <p>My webservice function that is being called is:</p>
  <pre><code>[WebMethod]
  public string CreateMarkers(string markerArray)
  {
      return &quot;received markers&quot;;
  }
  </code></pre>