Okay, so not sure if this is a Slim issue, or because you are encoding and decoding JSON or not, but for now the following work around works…
(...)
if ($v->passes()) {
$result = $this->db->connection()->select("CALL getPoints();"));
$data = json_encode($result, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK );
} else {
$data = json_encode([
'msg' => APP_MSG_ERROR_NOT_DATA,
'error' => true
]);
}
then output as normal while only setting the header:
return $response->withHeader('Content-Type', 'application/json')->withStatus(200)->write($data);
in my quick test it returns this:
{"data":"cámera"}
I only had time to test this quickly, so haven’t looked into whether this is an issue with withJson() or not but thought you might want to use the workaround to carry on…