I'm trying to create a simple cookie using javascript . But for some reason , json.stringify doesnt seem to work
i have the below object
var text = JSON.stringify({username: req.user.username})
which i send back as the cookie
res.cookie('user',text)
however , the client side stores the cookie in this format
user=%7B%22username%22%3A%22Kannaj%22%7D
how do i escape the '%' characters and store it as a stringified JS object?
%characters are escape sequences. The storage is fine. You just need to unescape it when you want to read the data.