as usual I’m working with my messed up database and I found that there are some fuxked up JSON string in the database… Some of the JSON strings are missing the double-quotes around the keys and/or values.
I’m thinking of writing a PHP script to fix that, what recommendations do you guys have about how I can detect the missing quotes and automatically add them? Or there is no such convenient way…
Thanks smart community!
You can use json_decode and json_last_error to detect if there is an error in the string. And then json_encode to write the valid json value back out.