Welcome Guest, Not a member yet? Register   Sign In
APIResponseTrait JSON_NUMERIC_CHECK
#1

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.
Reply
#2

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.
Reply
#3

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`.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB