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);