Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

convert cookies to json javascript

let cookie = "referer=example.com/post?id=22;bcomID=8075; subreturn=example&fuzzy=true&ct=null&autobounce=true; JSESSIONID=6D20570E1EB; mbox=session"; // sample cookies
let output = {};
cookie.split(/s*;s*/).forEach(function(pair) {
  pair = pair.split(/s*=s*/);
  output[pair[0]] = pair.splice(1).join('=');
});
let json = JSON.stringify(output, null, 4);
console.log(json);
Comment

PREVIOUS NEXT
Code Example
Javascript :: dinosaur game hacks 
Javascript :: search in string array javascript 
Javascript :: webpack bundle analyzer 
Javascript :: regular expression special characters 
Javascript :: DragDropContext 
Javascript :: js export multiple functions 
Javascript :: javascript on keypu 
Javascript :: Angular ion-search 
Javascript :: getting current date and time in javascript 
Javascript :: js conditional object key 
Javascript :: datepicker strart with monday 
Javascript :: two sum javascript 
Javascript :: generate component react 
Javascript :: window.location.href another tab 
Javascript :: jquery noconflict 
Javascript :: Javascript Regex for non-negative numbers 
Javascript :: how to define state in react function 
Javascript :: js iterate match indexes 
Javascript :: jquery replace html 
Javascript :: js math.random 
Javascript :: start a react native project with type script 
Javascript :: api testing 
Javascript :: how to disable keyboard calender input in material ui datepicker reactjs 
Javascript :: how to debug jest test vscode 
Javascript :: how to use Space for vertically in antd 
Javascript :: how to install yup in react native 
Javascript :: for open new tab we are using window.open but new tab are open in left side how to change the right side 
Javascript :: createelement with id javascript 
Javascript :: bigger or equal javascript 
Javascript :: upload multiple files axios 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =