I am using symfony 1.4, to create my project with propel as ORM. i want to get the response in JSON format, when i call a url. I have set the headers to "application/json" but it is not working, i am getting the response back in HTML format..which i am not able to decode. How can we set content-type in symfony?? example code: Action-
public function executeIndex(sfWebRequest $request)
{
$data_array=array("name" => "harry", "mobile" => "9876543210");
$data_json=json_encode($data_array);
$this->output=$data_json;
}
View-
<?php
header('Content-type: application/json');
echo $output;
?>