PHP removes the backslash in the json string and the backslash before the double quotation marks. json double quotation marks. PHP removes the backslash in the json string and the backslash before the double quotation marks. json double quotation marks are sometimes escaped by adding a backslash (") to the json string uploaded to PHP through AJAX, during PHP processing, PHP needs to remove the backslash \ in the json string and the backslash before the double quotation marks. json double quotation marks
The json string uploaded to PHP through AJAX is sometimes escaped by adding a backslash "\". during PHP processing, you need to remove the backslash and then use json_decode.
$ Str = stripslashes ($ _ POST ['json']); $ arr = json_decode ($ str, true );
PS: php get how to remove the backslash before double quotation marks when capturing json
If your data is not in the standard JSON format, you can replace \ "with" first.
Use the json_decode () system function to convert it into a json object. if you want to convert it into an array, add the second parameter to true.
If the output is still NULL, the BOM header information exists,
The code is as follows:
$ Arr = json_decode (trim ($ json, chr (239). chr (187). chr (191), true );
Convert.
This article describes all the content, hoping to help you remove the backslash \ in the json string and the backslash before double quotation marks in PHP.
Sometimes the backslash (\) is added to the json string uploaded to PHP through AJAX. it is required for PHP processing...