title: CakePHP 1.1 - How to response in JSON
body: <p>I am developing API with PHP cake 1.1. I want to write response as JSON. I found a lot of content for PHP Cake 1.2 or 1.3 but not for 1.1. </p>
  
  <p>Here is my controller code</p>
  
  <pre><code>function index() {
     $this-&gt;layout = 'ajax';
     $this-&gt;RequestHandler-&gt;setContent('json', 'application/json');
     $members['id'] = '001100';        
     $this-&gt;set(compact('members'));    
  }
  </code></pre>
  
  <p>here is view code</p>
  
  <p><code>echo json_encode($members);</code></p>
  
  <p>My problem is that, response content type is still <code>Content-Type: text/html</code></p>
  
  <p>Is there any way that I do not have to create view for each function and just write <code>json</code>.</p>
  
  <p>Please help me out.</p>
  
  <p>Thanks,
  Adil</p>