title: C# Return JSON instead of a view (MVC)
body: <p>I want to use AJAX to recieve a <strong>JSON array</strong> from the <strong>controller</strong>. In <strong>php</strong> you can just return <strong>string</strong> instead of a <strong>view</strong> so you can do something like that:</p>
  
  <pre><code>$array = array(
  "Hello" =&gt; "hi", 
  "Whatsup" =&gt; sup
  );
  return json_encode($array);
  </code></pre>
  
  <p>However, in <strong>C#</strong> you have to return <strong>ActionResult</strong> object. So until now I didn't find a good solution for "printing" the <strong>JSON array</strong> as the result.</p>