Tag Archives: json_encode gives extra slash

json writer adding extra slash to the serialized file

if you are getting the serialize result with extra slash like below {“uploaded_path”:”C:\\xampp\\htdocs\\myproject\\public\\assets\\uploads\\myimages This issue normaly occurs when missed the json_decode function in the code For example Refer the below lines of code $upload_data = array(‘uploaded_path’ => $destinationPath); $jsonformat=serialize(json_encode($upload_data)); print_r($jsonformat); // this will output as, {“uploaded_path”:”C:\\xampp\\htdocs\\myproject\\public\\assets\\uploads\\myimages To remove the double slashes you can use theā€¦ Read More »