phpcookiesserveraddslashes

My server addslashes automatically


My server adds slashes in cookie value. Please help me to off this.

current cookie value is like this,

{\"pId\":\"7\",\"unit\":\"1\",\"uniqueId\":1430215177,\"color\":\"\",\"size\":\"\"}

But I want it to be like this,

{"pId":"7","unit":"1","uniqueId":1430215943,"color":"","size":""} 

Solution

  • You can use stripslashes function available in php like this :

    $jsonString = " {\"pId\":\"7\",\"unit\":\"1\",\"uniqueId\":1430215177,\"color\":\"\",\"size\":\"\"}"
    stripslashes($jsonString);