APIResponseTrait JSON_NUMERIC_CHECK |
Hello all,
I wonder is there any easy way to achieve putting JSON_NUMERIC_CHECK option while encoding to JSON with API Response Trait. Kind regards.
Hi,
What function are you using? Are you using the getJSON? If so you can make your own $formatters, see /app/Config/Format.php You need to make a copy of \CodeIgniter\Format\JSONFormatter and replace it with your own.
If you are using the latest version, you can use the $formatterOptions in app/Config/Format.php. Then in the `application/json` key, just include the new set of default flags there, which include `JSON_NUMERIC_CHECK`.
|
Welcome Guest, Not a member yet? Register Sign In |