tough-cookie.cookiejar.fromjson.md

July 9, 2025 ยท View on GitHub

Home > tough-cookie > CookieJar > fromJSON

CookieJar.fromJSON() method

Alias of CookieJar.deserializeSync().

Signature:

static fromJSON(jsonString: string | SerializedCookieJar, store?: Store): CookieJar;

Parameters

Parameter

Type

Description

jsonString

string | SerializedCookieJar

A JSON string or object representing the deserialized cookies.

store

Store

(Optional) The underlying store to persist the deserialized cookies into.

Returns:

CookieJar

Remarks

  • When no Store is provided, a new MemoryCookieStore will be used.

  • As a convenience, if strOrObj is a string, it is passed through JSON.parse first.