This article describes how to remove backslashes from json strings in PHP and the backslashes before double quotation marks in PHP. For more information, see
This article describes how to remove the backslash \ from the json string in PHP and the backslash before double quotation marks in PHP. For more information, see
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.