Dibyendu Konar
Dibyendu Konar

Reputation: 165

Issue sending url in json

I am sending a json response like this:

[{"Link":{"iTune":"https:\/\/itunes.apple.com\/in\/app\/mx-video-player-play-hd-videos\/id730291646?mt=8"}}]

But the problem is associated with this is that this contains the special character

my code:

header('Content-type: application/json');
    $gamePlatform[] = array("Link" => array('iTune' => $iTune));

        echo json_encode($gamePlatform);

how to send the proper link guys please help me out

Upvotes: 1

Views: 1702

Answers (1)

aldrin27
aldrin27

Reputation: 3407

Use str_replace():

    $gamePlatform[] = array("Link" => array('iTune' => $iTune));

    $json = json_encode($gamePlatform);
    $a = str_replace('\/', '/', $json);
    echo $a;

Upvotes: 2

Related Questions