I am using json_encode in PHP to encode an URL
json_encode
$json_string = array (\'myUrl\'=> \'http://example.com\'); echo json_encode ($json_string); >
If you are using php 5.4 you can use json_encode options. see the manual.
Several options added in php 5.3 but JSON_UNESCAPED_SLASHES in 5.4.
JSON_UNESCAPED_SLASHES