title: Return JSON via MVC controller vs webmethod
body: <p>I'm trying to convert a web forms page with a number of code-behind <code>webmethod</code> functions into an MVC view with a controller. </p>
  
  <p>The data I get back is different. They have properly formatted JSON, but the webmethod returns JSON like this:</p>
  
  <pre><code>{"d":"{\"Success\":true,\"Data\":{\"QuoteId\":340439,\"LoginId\":40,
  </code></pre>
  
  <p>And the controller returns: </p>
  
  <pre><code>"{\"QuoteId\":340444,\"LoginId\":40,
  </code></pre>
  
  <p>Its not wrapping it in <code>data.d</code> like it is set up to handle in the javascript and there are no <code>Success</code> or <code>Data</code> objects. And when I try to parse it (<code>$.parseJSON(data)</code>) like I did with the <code>webmethod</code>, it gives me the old error at line 1 message. </p>
  
  <p>I'm sure that if I played with it enough I could get it to work with the way the data is coming through, but I have many pages that I need to covert in the future and I'm just wondering if there is an easy way to get the controller to format it like the <code>webmethod</code> does. </p>
  
  <p>I'm pretty sure that I know why the data is formatted differently, but it would make my life easier if I could just return the data in the same way. I've tried returning a <code>JsonConvert.SerializeObject(obj)</code>, which is just a string, and a <code>Return Json(obj)</code>, which I'm guessing is just a string as well, but they both return stuff the same, non-data.d way. </p>