I am using json_encode method to pass a string in a web service.
$send_message_code="";
$send_message_code .='<a href="http://www.epbitservices.com/webservices/R/1/" style="text-decoration:none;">';
$send_message_code .='http://www.epbitservices.com/webservices/E/epbitservices/';
$send_message_code .='</a>';
$x['myvar']= $send_message_code;
$Text = json_encode($x);
echo $Text;
Now, it outputs it as
{"myvar":"<a href="\"http:\/\/www.epbitservices.com\/webservices\/R\/1\/\"" style="\"text-decoration:none;\"">http:\/\/www.epbitservices.com\/webservices\/E\/epbitservices\/<\/a>"}</a>
that is with additional closing anchor tag at the end.