logo
Search
showing results for - "convert cookies to json javascript"
Guilhem
30 Nov 2017
1let cookie = "referer=example.com/post?id=22;bcomID=8075; subreturn=example&fuzzy=true&ct=null&autobounce=true; JSESSIONID=6D20570E1EB; mbox=session"; // sample cookies
2let output = {};
3cookie.split(/\s*;\s*/).forEach(function(pair) {
4  pair = pair.split(/\s*=\s*/);
5  output[pair[0]] = pair.splice(1).join('=');
6});
7let json = JSON.stringify(output, null, 4);
8console.log(json);
similar questions
set cookie javascriptjs parse cookie stringjavascript cookiesjavascript set cookiejavascript set and get cookiejs set cookiehow to store an entire object in cookies javascriptjavascript create cookiejavascript cookies store objecthow to set cookies in javascriptchange a cookie with javascriptset and get cookie in javascriptcookies jsget cookie value in javascripthow to get httponly cookie in javascriptcookies manipulation javascript
queries leading to this page
convert cookies into js objectconvert cookie to object javascriptstore json in cookie javascriptjs get json string cookiesconvert cookie to json javascriptjavascript cookie set value jsonjson parse cookies become object objectget cookies to json javascriptjs cookie set value jsonconvert cookies to jsonhow to read json string cookie into jscookie to json jsconvert cookies to json javascriptdocuments cookies to json jsconvert cookies to json javascript
privacy policyterms of useinstagram
Crafted with  ♥  for everyone

sign in to continue
your answer for
you will get a confirmation link on this - you will have to click that for successful submission of your answer. we require this to keep the website free of spam, bots and unhelpful content
please ensure to add code which is syntactically corrent and executes properly
sign in to continue
ask question on maxinterview
you will get a confirmation link on this - you will have to click that for successful submission of your question. we require this to keep the website free of spam, bots and unhelpful content
please be clear, to the point and respectful
sign in to continue