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); >
I think this solves your problem
json_encode ($json_string, JSON_UNESCAPED_SLASHES );
You can see the documentation: https://www.php.net/manual/en/function.json-encode.php https://www.php.net/manual/en/json.constants.php