Slim: Response withjson converts the numbers to string

Created on 26 Dec 2017  路  2Comments  路  Source: slimphp/Slim

If i use withJson for response, it converts my numbers to string. How to avoid it?
example:

$data = array('name' => 'Rob', 'age' => 40);
$newResponse = $oldResponse->withJson($data, 201);
question

Most helpful comment

$data = array('name' => 'Rob', 'age' => 40);
$newResponse = $oldResponse->withJson($data, 201, JSON_NUMERIC_CHECK);

All 2 comments

$data = array('name' => 'Rob', 'age' => 40);
$newResponse = $oldResponse->withJson($data, 201, JSON_NUMERIC_CHECK);

Going to close this one as resolved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Zyles picture Zyles  路  4Comments

codeguy picture codeguy  路  3Comments

xymz picture xymz  路  5Comments

lwiwala picture lwiwala  路  5Comments

RobDWaller picture RobDWaller  路  4Comments