JSON与Cookie互转
Cookie 字符串与 JSON 键值对互相转换。
关于「JSON与Cookie互转」
它属于「JSON 工具」分类:JSON 的格式化、结构变换与各种数据格式互转。
- 把浏览器开发者工具里复制出的 Cookie 字符串转成结构化 JSON,便于查看与编辑。
- 解析时会自动对值做 <b>URL 解码</b>,中文字段能正常显示。
- 反向生成时可选择是否进行 URL 编码;含中文或特殊字符时建议保持勾选。
- 只处理 <code>名=值</code> 部分,不涉及 <code>Path</code>、<code>Expires</code>、<code>HttpOnly</code> 等属性。
- 调试接口鉴权、批量构造请求头时很实用。
完全免费、无需注册;所有处理都在浏览器本地完成,文件不会上传到任何服务器。
相关关键词:JSON与Cookie互转、JSON 工具、cookie、互转、在线工具、免费
如何使用「JSON与Cookie互转」
- 打开工具:打开「JSON与Cookie互转」页面,无需注册、无需安装任何软件。
- 准备输入:准备好要处理的内容或文件:文本可直接粘贴,文件可拖入页面(本工具属于「JSON 工具」)。
- 填入内容:把内容粘贴进输入框,或把文件拖入页面;也可以点击「示例」先填入样例数据试一下。
- 设置选项并处理:按需调整页面上的选项,然后点击处理 / 转换 / 生成按钮。
- 获取结果:处理完全在浏览器本地完成,结果可直接复制或下载,文件不会上传到任何服务器。
常见问题
- 从哪里获取 Cookie 字符串?
- 打开浏览器开发者工具,在 Network 面板选中任意请求,在请求头中找到 Cookie 一项,把它的值整段复制过来即可。
- 为什么值里有很多百分号?
- 那是 URL 编码。Cookie 只允许 ASCII 字符,中文等内容必须先编码。本工具解析时会自动还原成可读文本。
- 能设置过期时间等属性吗?
- 不能。这些属性属于服务端下发 <code>Set-Cookie</code> 时的响应字段,而请求头里的 Cookie 只包含名值对,因此工具只处理名值部分。
JSON ⇄ Cookie (English)
Convert between Cookie strings and JSON key-values.
Belongs to “JSON Tools”: Format, transform and convert JSON to and from various data formats.
- Convert a Cookie string copied from browser devtools into structured JSON for easy viewing and editing.
- Values are auto <b>URL-decoded</b> on parse, so Chinese fields display correctly.
- When generating, you can choose whether to URL-encode; keep it on for Chinese/special characters.
- Only the <code>name=value</code> part is handled; <code>Path</code>, <code>Expires</code>, <code>HttpOnly</code> etc. are ignored.
- Handy for debugging API auth and building request headers in bulk.
Free, no sign-up; everything runs locally in your browser and files are never uploaded.
Keywords: JSON ⇄ Cookie, JSON Tools, cookie, convert, online tool, free
How to use it
- Open the tool:Open the “JSON ⇄ Cookie” page — no sign-up and nothing to install.
- Prepare the input:Prepare the content or file to process: paste text or drop a file onto the page (this tool belongs to “JSON Tools”).
- Provide the input:Paste your content into the input box or drop a file onto the page; you can also click “Sample” to try example data first.
- Adjust options and run:Adjust the options if needed, then click the process / convert / generate button.
- Get the result:Everything runs locally in your browser; copy or download the result — your files are never uploaded.
FAQ
- Where do I get the Cookie string?
- Open browser devtools, pick any request in the Network panel, find the Cookie header, and copy its value in full.
- Why are there many percent signs?
- That is URL encoding. Cookies allow only ASCII, so Chinese must be encoded first; this tool decodes it back to readable text.
- Can I set expiry and other attributes?
- No. Those belong to the server's <code>Set-Cookie</code> response; the request Cookie only has name-value pairs, so the tool handles just those.
More tools in JSON Tools
- JSON Formatter/Minifier — Beautify, minify, validate and highlight JSON.
- Sort JSON Keys — Recursively sort object keys alphabetically to ease diffing.
- Flatten JSON — Flatten nested structures into a.b.c single-level keys.
- Unflatten JSON — Restore dotted-path objects into nested structures.
- JSON to CSV — Convert an array of objects into a downloadable CSV.
- CSV to JSON — Parse CSV text or files into a JSON array.
- JSON to Excel — Export an array of objects as an .xlsx workbook.
- Excel to JSON — Upload an Excel file and convert sheets to JSON.
- JSON to XML — Convert JSON structures into well-indented XML.
- XML to JSON — Parse an XML document into an equivalent JSON object.
- JSON to YAML — Convert JSON into more readable YAML.
- YAML to JSON — Parse YAML config into standard JSON.
- JSON to SQL — Generate INSERT statements and CREATE TABLE DDL from arrays.
- SQL to JSON — Reverse-engineer JSON data from INSERT statements.
- JSON to Base64 — Convert JSON to and from Base64 with UTF-8 support.
- JSON Diff — Recursively compare two JSON documents, marking add/delete/change.