0

I used Facebook API but Json returned:

{
   "id": "674271626114503",
   "email": "duc2521997\u0040gmail.com"
}

How to decode '\u0040' to '@' by PHP ? Thanks.

1 Answers1

1

Try this, here we are using json_decode will itself take care of \u0040 to @

Try this code snippet here

<?php
ini_set('display_errors', 1);
$string='{
   "id": "674271626114503",
   "email": "duc2521997\u0040gmail.com"
}';
$array=  json_decode($string,true); //this itself will take care of `\u0040`
echo $array["email"];

Output: duc2521997@gmail.com

Sahil Gulati
  • 15,028
  • 4
  • 24
  • 42