how to convert HTML data to json, example as below, description content how to convert as json, it is from mysql, php., how to send json responce as plain text, but description comes from the mysql db as it is, but how to send the json responce api to androind.
public function actionTestanalysis()
{
//echo $keyword=$_POST['keyword'];
$query= Yii::app()->db->createCommand("select * from test ORDER BY id DESC")->queryAll();
$arr = array();
if(count($query) > 0) {
foreach($query as $query){
$arr[] = $query;
}
}
# JSON-encode the response
$json_response = json_encode($arr);
// # Return the response
echo $json_response;
//exit;
}
json responce
[
{
"id": "99",
"name": "Max-Gain on or before 25th January 2016 in Max India Limited.",
"description": "
\tMax India Limited has announced the Record date for Three way De-Merger as 28th January 2016 (Thursday). <\/div>
\t <\/div>
\tAnyone want to Gain from the three way De-Merger of Max India Group one should buy the shares of Max India Limited on or before – 25th January 2016 (Cum-Date – Monday Tentavily) otherwise to be on safer side you can buy on or before 22nd January 2016(Friday) and get invested in it.<\/div>
\t <\/div>
\tIf any investor invests for a period Of 12 – 18 Months , this scrip will be a Multifold - Multi Bagger.<\/div>
\t <\/div>
\tTo View the full report on Max India Limited authored . <\/div>
\t <\/div>
\tPlease Click The Below Link<\/div>
\t
\t\thttp:\/\/www.test.com\/index.php\/newsOpportunities\/list\/scroll\/no-pain-all-gain-maximum-benefit-in-max-india-ltd<\/a><\/p>
<\/div>
",
"image": "",
"status": "unlock"
},