Json will not tell me the results


I’M MAKING A REST API WITH SLIM I’M CONSULTING A TABLE THAT HAS A LOT OF DATA WHEN I CHECK THE API DOES NOT PRINT THE VALUES I send it to print with an echo json_encode ($ data); And it does not work, but if I send it without the json_encode if I print it. help me please.


Not enough information to diagnose. However ensure that you return a response object:

$app->get('/endpoint', function ($request, $response) {
    $data = someFunctionThatGetsTheDataAndReturnsAnArray();

    return $response->withJson($data);