<p>I'm having difficulty parsing some JSON data returned from my server using jQuery.ajax()</p>

<p>To perform the AJAX I'm using:</p>

<pre><code>$.ajax({
  url: myUrl,
  cache: false,
  dataType: "json",
  success: function(data){
    ...
  },
  error: function(e, xhr){
    ...
  }
});  
</code></pre>

<p>And if I return an array of items then it works fine:</p>

<pre><code>[ { title: "One", key: "1" }, { title: "Two", key: "2" } ]
</code></pre>

<p>The success function is called and receives the correct object.</p>

<p>However, when I'm trying to return a single object:</p>

<pre><code>{ title: "One", key: "1" } 
</code></pre>

<p>The error function is called and xhr contains 'parsererror'.  I've tried wrapping the JSON in parenthesis on the server before sending it down the wire, but it makes no difference.  Yet if I paste the content into a string in Javascript and then use the eval() function, it evaluates it perfectly.</p>

<p>Any ideas what I'm doing wrong?</p>

<p>Anthony</p>

Is your server sending data as Content-Type
```
"*/json"
```
? If not, modify the response headers accordingly. Sending
```
"application/json"
```
would be fine, for example.