json_encode returns an empty string

If you are trying to grab some information through a web service in JSON format and if PHP function json_encode returns you an empty string, you need to convert the JSON object to UTF8.

Code Sample:

function utf8ize($d) {
    if (is_array($d)) {
        foreach ($d as $k => $v) {
            $d[$k] = utf8ize($v);
    } else if (is_string ($d)) {
        return utf8_encode($d);
    return $d;



Say Hello! Don’t be shy.