I know this is old, but I did not find an explanation for this error. In my case, the problem was to throw the values into the database with an accent (Ej: cafetería). var_dump ($ emparray) certanly shows information, but echo json_ecode ($ emparray) shows nothing. Decision?
This is my link to DB:
$connection = mysqli_connect('ip,'user','pass','dbname')
or die("Error " . mysqli_error($connection));
You only need to add the correct encoding:
mysqli_set_charset( $connection, 'utf8');
Performs this work for others.