“Converter cookies em JSON JavaScript” Respostas de código

Converter cookies em 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);
Frightened Fish

Converter cookies em JSON JavaScript

.netflix.com	TRUE	/	FALSE	16741247166642634	clSharedContext	88ed82a7-bb73-4e31-9658-785172a8d9f2
.www.netflix.com	TRUE	/	FALSE	16741247166652406	cL	1641704423039%7C164170440787166804%7C164170440778422941%7C%7C7%7Cnull
.netflix.com	TRUE	/	FALSE	1673240423	nfvdid	BQFmAAEBED0fK11rNC7jqXWJAPaMHuNgmvgptLSIEz7ucw6ZlwCYn58B0301FhdSdpmzmHRgUpkpHg9OPY1S0-MIeVz1MkHK2Kvx3zGkNgmhvLXTIAU_KK9J5A01bLqglNud1us90E3rOb0qRQWvBo7r3hyAjnCJ
.netflix.com	TRUE	/	FALSE	1673329732	NetflixId	v%3D2%26ct%3DBQAOAAEBEEAdm0s_C9XePk_-7bEIx3eB0PeeBiAC5r8zV92ao1VvKX4oygL_OgHJiH988C6mbmILOxPMut67OEvfpB9nuVo3i5gOfSOOUdRhwQJTDyaET2uuLYJ1CBqUDgi5pHRgoCGZ2_odO7_qMV3e4OSAo2o6SfbfuhYzJAQDavNRXREAUocNzmK7CFzdp3uezmCrOrP_-BV88yU6KqMR5GMOuhOxYocKLvllPYLJJaMjxGyktRroHkJJPAkC9jKg6geQ6HSI7CmMi09Fsu6iiCwBerZ5GmtNAxnQ9IsUutRecRLzClZxN0yew-eLzDGjBylHiJ_xD69yKZpSC1pg-K6TVKZIWrUhO6amlzDs_IKaKYnUnAobsxqTyESqOAmMq3sAyrvnUGWsaIPesV1makbpUKyR7iMZ7YrRtOp_XjWpAd_Jc9mr2XRmneujZJhzFPhYq7XB-Sm_2_giI7ieguJKBaUJ3nQe8jFJHIXIBy9PFF1wA0G0HZdLR8r7aSPjXka2TPTfC7XKh6SgkDAqVkO-9PZHqN9YH4_8BSq_OJWRnUN1UH_7-mdvXVCnfsWnDLweGuPXZ8o9VzNAl_xwdEHuNZ2lp66fXWuvQ1c0cw4Y8uIRXD7nIT3sIZPWE0bTt8kbcErC%26bt%3Ddbl%26ch%3DAQEAEAABABS4jM3f9n-7Fh8XmLSrao7z7jKWsTHH2Is.%26mac%3DAQEAEAABABRaOGnl7XaVXV2t2xgxBU1aV4PP-_ovZrA.
.netflix.com	TRUE	/	FALSE	1673329732	SecureNetflixId	v%3D2%26mac%3DAQEAEQABABQY8HaAw2preLGbLKcvrSPg3uEH5hk5tcs.%26dt%3D1641793731991
.netflix.com	TRUE	/	FALSE	1673330422	OptanonConsent	isIABGlobal=false&datestamp=Mon+Jan+10+2022+03%3A00%3A22+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=6.6.0&consentId=9bd83ecd-5a63-47cb-9eec-04134f74e8e9&interactionCount=1&landingPath=NotLandingPage&groups=C0001%3A1%2CC0002%3A1%2CC0004%3A1&hosts=H12%3A1%2CH13%3A1%2CH27%3A1%2CH28%3A1%2CH30%3A1&AwaitingReconsent=false
.netflix.com	TRUE	/	FALSE	1649570421	playerPerfMetrics	%7B%22uiValue%22%3A%7B%22throughput%22%3A10.4822%7D%2C%22mostRecentValue%22%3A%7B%22throughput%22%3A10.4822%7D%7D
.netflix.com	TRUE	/	FALSE	1673331036	memclid	634eb922-9ba8-49ac-be55-d14a9cde073b
.netflix.com	TRUE	/	FALSE	1641796819	profilesNewSession	0
Drakz_z

Respostas semelhantes a “Converter cookies em JSON JavaScript”

Perguntas semelhantes a “Converter cookies em JSON JavaScript”

Mais respostas relacionadas para “Converter cookies em JSON JavaScript” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código