Hi, I am returning a simple array:
return ['ABC' => 'DEF'];
which passes through the CoreFunctions, more explicitly $response->withJson($resp)
.
I am expecting a JSON object returned in the format:
{
"ABC": "DEF"
}
But I get nothing back (and the response header is set to text/html; charset=UTF-8
) .
However, if I run
return json_encode(['ABC' => 'DEF']);
then I get the expected outcome.
I thought ->withJson would do the above, or is this expected behaviour? (I’m running Slim 3.9.2)