Skip to content
claudecookie
Back to the converter

JSON cookie formats

There is no single JSON cookie format. Four shapes are in common use, and they store different amounts of information. This is what each one looks like and what it can hold.

What each format can store

FormatDomainExpiryFlags
Cookie-Editor and EditThisCookieYesYesYes
Puppeteer and PlaywrightYesYesYes
Key-value mapNoNoNo
Cookie header stringNoNoNo

The four shapes

Puppeteer and Playwright

What page.setCookie() and context.addCookies() accept. Expiry is called expires and uses -1 for session cookies. sameSite uses the HTTP spelling: None, Lax and Strict. Omitting sameSite lets the browser apply its own default, so we leave it out when it is unspecified.

Used byPuppeteer, Playwright, Selenium wrappers

Example
[
  {
    "name": "session_id",
    "value": "8f14e45fceea167a5a36dedd4bea2543",
    "domain": ".example.com",
    "path": "/",
    "expires": 1798761600,
    "httpOnly": false,
    "secure": true
  },
  {
    "name": "auth_token",
    "value": "eyJhbGciOiJIUzI1NiJ9.e30.ZRrHA1JJJW8opsbCGfG_HACGpVUMN_a9IV7pAx_Zmeo",
    "domain": ".example.com",
    "path": "/",
    "expires": 1798761600,
    "httpOnly": true,
    "secure": true
  },
  {
    "name": "theme",
    "value": "dark",
    "domain": "example.com",
    "path": "/account",
    "expires": 1798761600,
    "httpOnly": false,
    "secure": false
  },
  {
    "name": "cart_preview",
    "value": "tmp-4471",
    "domain": ".example.com",
    "path": "/",
    "expires": -1,
    "httpOnly": false,
    "secure": false
  }
]

Key-value map

A flat object of names to values. This is what you hand to a requests session or an axios config. It stores nothing else at all — no domain, no expiry, no flags.

Used byPython requests, axios, fetch wrappers

Example
{
  "session_id": "8f14e45fceea167a5a36dedd4bea2543",
  "auth_token": "eyJhbGciOiJIUzI1NiJ9.e30.ZRrHA1JJJW8opsbCGfG_HACGpVUMN_a9IV7pAx_Zmeo",
  "theme": "dark",
  "cart_preview": "tmp-4471"
}

Converting between them loses information

Going from a complete format to key-value or a header is one-way: the domain, path, expiry and flags have nowhere to be stored. Converting back gives you session cookies with whatever domain you supply. The converter warns you when a conversion would drop data.

Try it in the converter

Converter