Reputation: 404
I'm trying to grab data from twitter. I'm success to return data to array. BUt, when i change it to json using json_encode, some data have weird characters.
{
"name": "\u24d7\u24d8\u24db",
"url": "http:\/\/t.co\/m3rqX58egq",
}
what's wrong? is it related to utf8 encode and JSON_UNESCAPED_SLASHES?
Upvotes: 1
Views: 523
Reputation: 248
Yes it is related to JSON_UNESCAPED_SLASHES and it is available since PHP 5.4.0.
return json_encode($array,JSON_UNESCAPED_SLASHES);
Upvotes: 4
Reputation: 137
This is likely due to the Special characters coming back in the JSON, Have a look at htmlSpecialChars() Or see this answer
Upvotes: 0