That's the correct way to return values in JSON. Remember it's JSON and not Javascript object literals.
If you want to get a grip on things on a global scale then you'll need to write your own json parser.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm having a major issue where responses from Laravel controllers are returning all numbers as strings, including boolean 0/1 values, so my front end (Vue.js) interprets any string, like "0", as true, and all logic breaks.
I see people talk about this, and say Oh, just use JSON_NUMERIC_CHECK, but I'm not expressly stating json_encode, as Laravel returns arrays that way. And there are hundreds of responses. I also can't fix on the front end, because sometimes it's a v-if against a boolean, sometimes it's a v-model to automatically determine if a checkbox should be checked or not, so there's no particular string to search on and replace.
This is a HUGE project that's been developed just fine, but when we put it on the client's server, this is what I get!
So my question is, how do I address this issue in a global sense? What causes the string return, PHP, MySQL? Is there a setting I can change? Thanks for any suggestions.
Please or to participate in this conversation.