JSON to Cookie header converter

Useful for replaying a session in Postman, curl or an automated test from cookies saved as JSON.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter json, percent-encode values and add the cookie: prefix.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

Each key and value become name=value, joined by a semicolon and a space. With encoding on, the value goes through encodeURIComponent; without it the value is checked for spaces, ", comma, ; and \, which RFC 6265 does not allow.

Example

Inputs: Percent-encode values = yes, Add the Cookie: prefix = no. Result: Cookie header: session_id=abc123; theme=dark; lang=ar; Cookies: 3.

{"session_id": "abc123", "theme": "dark", "lang": "ar"}
session_id=abc123; theme=dark; lang=ar

Limits and caveats

  • Cookie names must be HTTP tokens, so spaces or characters such as = and ; in a name give an error.
  • Nested objects or arrays are not accepted as values; turn them into text first.

Questions about this tool

Do I need to encode the values?

Yes when they contain spaces, commas or Arabic text, which a cookie value cannot hold unencoded.

How do I use the result with curl?

Put it in quotes after -b, or turn on the prefix and pass it with -H.

Are attributes such as Path and Expires supported?

No. Those belong to Set-Cookie sent by the server; a Cookie header carries only names and values.