How can i add numeric check to withJson

I search the forum but nothing comes up. How can I add JSON_NUMERIC_CHECK to wihJson

$app->get('/icerikan/[{ad}]', function ($request, $response, $args) {
$sth = $this->db->prepare("SELECT * FROM anime WHERE ad=:ad");
$sth->bindParam("ad", $args['ad']);
$sth->execute();
$todos = $sth->fetchAll();
return $this->response->withJson($todos);
});

Hi @NasuhG,

I believe you can pass the encoding options as the third parameter of the withJson method. Have a look at the Response class where it is described:

public function withJson($data, $status = null, $encodingOptions = 0)

You might do something like this:

return $this->response->withJson($todos, 200, JSON_NUMERIC_CHECK);