• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.