TL DR: missing quotes is how Chrome shows that it is a JSON object, not a string. Make sure you have a header ('Content-Type: application / json; charset = UTF8'); in PHP, AJAX answer to solve a real problem.
DETAILS. A common reason for wanting to solve this problem is to detect this difference when debugging the processing of returned AJAX data.
In my case, I saw the difference using the Chrome debugging tools. When successfully connecting to an outdated system, Chrome showed that no quotes around the keys in the response were shown in the debugger response. This allowed the object to be immediately processed as an object without using the JSON.parse () call. When debugging my new AJAX assignment, quotes were shown in the response, and the variable was a string, not an object.
I finally realized the true problem when I tested the AJAX answer when I saw that the legacy system actually contained quotation marks around the keys. This was not what the Chrome Developer Tools showed. The only difference was that in the old system there was a header indicating the type of content. I added this to the new system (WordPress), and now the calls were fully compatible with the original script, and the success function could process the response as an object without any analysis. Now I can switch between the obsolete and the new system without any changes except the destination URL.
source share