3 min read

JSON Map vs JSON Array: why maps default to localhost

A JSON Map cookie export is a flat { "name": "value" } object; converting it to JSON Array here will warn that each cookie defaulted to localhost because a map has no domain, path or flags.

Use a map only for quick scripts. Use an array of objects for anything that must be imported into a browser.

JSON map cookiesJSON array vs mapcookie JSON objectlocalhost default domain
  1. 1
    Paste the map

    An object whose values are strings is detected as JSON Map. Nested objects under each key are treated as cookie fields with the key as name.

  2. 2
    Convert to JSON Array

    Read the warnings. Every string value becomes a session cookie on localhost. Edit domains in the output before Import.

  3. 3
    Import only after domains are real

    CookieMan will write whatever domain is in the JSON. Leaving localhost is the usual reason an import “works” and the site still shows logged out.

Cookies are credentials. Conversion stays in this page — delete the file when you are done.

Defaults applied to every map entry

FieldJSON Map sourceAfter parse
name / valueobject key / string valuePreserved
domainnonelocalhost + warning
pathnone/
secure / httpOnlynonefalse
sameSitenoneunspecified
sessionnonetrue
hostOnlynonetrue
The warning text is exact: Cookie "session_id" from map has no domain, defaulted to localhost. That is not a crash. Ignoring it writes useless cookies. See missing domain → localhost.

When map values are objects

If a value is an object, it is passed through the JSON object normaliser with the key as name. Then domain, path and flags inside that object are honoured. A map of full cookie objects is therefore richer than a map of strings — but at that point you should have used a JSON array.

            {
  "session_id": "abc123",
  "theme": "dark"
}

# warns twice, both domains localhost

{
  "session_id": { "value": "abc123", "domain": ".example.com", "secure": true }
}

# one cookie, domain kept
          

Questions people ask

Why does detectFormat pick JSON Map not Array?
The payload starts with { and is not an array. If you also have a cookies array (Playwright), that wrapper is unwrapped as an array instead.
Can I export JSON Map from CookieMan on purpose?
Yes — it is the compact name→value dump. You throw away attributes. Do not use it as a backup format.
Is a JSON Map the same as a Cookie header?
Same information content (names and values), different syntax. Both lack domain. Header detection is used when the text is not valid JSON.
3 min read

JSON Array vs cookies.txt Field Mapping

Side-by-side mapping of CookieMan JSON Array fields to Netscape cookies.txt. SameSite, partitionKey and store metadata never survive the seven-column file.

JSON vs cookies.txtcookies.txt field mapping Open the guide
3 min read

Fix Cookie Domain Defaulted to localhost

Header strings and JSON maps have no domain, so CookieMan writes localhost and warns. Convert to JSON Array, set a real host, then import or export Netscape.

Cookie missing domaindefaulted to localhost Open the guide
3 min read

Python Requests CookieJar from JSON

Convert browser JSON to Netscape for Requests via MozillaCookieJar, or to a Cookie header. Set domains before you call the host.

Python requests cookiesMozillaCookieJar Open the guide

Apply this on live cookies

The converter rewrites files. The extension reads and writes the jar in Chrome, including HttpOnly cookies.

Free and MIT-licensed · Chrome, Edge and other Chromium browsers · Nothing leaves your machine