JSON 格式化
格式化、校验和压缩 JSON,以可折叠的树形结构浏览,用 JSONPath 过滤,自动修复错误语法,并生成 TypeScript 接口或 Zod schema。
完全在浏览器中运行 — 粘贴的内容不会被上传。
键、$、[0]、数组通配符 [*]、对象通配符 * —— 例如 $.posts[*].slug。输出和树形跟随过滤条件,留空则使用整个文档。
{
"id": 42,
"name": "RYUSLOG DEV",
"tags": [
"json",
"typescript"
],
"owner": {
"handle": "r39",
"verified": true
},
"posts": [
{
"slug": "json-format",
"views": 1200
},
{
"slug": "jwt-decode",
"views": 860
}
]
}格式化在浏览器中运行,无效 JSON 也不会发送到任何地方。
JSON 速查表
快速参考- JSON.parse(text)
- 把 JSON 字符串解析为值;出现末尾逗号或单引号会抛出 SyntaxError。
- JSON.stringify(value, null, 2)
- 以两空格缩进美化输出;第三个参数可以是空格字符串或空格数量。
- undefined, function
- 在对象中被丢弃,但在数组中序列化时会变成 null。
- Date
- 经由 toJSON() 序列化,因此 Date 总是变成 2026-11-16T05:00:00.000Z 这样的 ISO 8601 字符串。
- "{\"a\":1}"
- 日志或环境变量里被转义的 JSON 字符串,解析前需要先反转义一次。
- $.posts[*].slug
- 路径过滤用的 JSONPath:$ 是根,.key 读取对象键,[0] 读取数组下标,[*] 收集所有元素。
TypeScript 相关语法指南
全部 TypeScript 指南Zod infer vs TypeScript Interfaces: Runtime Validation Gaps
An interface validates nothing, z.infer is the output type and not the input, and Zod 4 renamed the error helpers. What each one actually guarantees.
TypeScriptTypeScript Decorators: Standard vs experimentalDecorators
TS1240 appears when a legacy decorator meets the stage 3 transform, and the reverse breaks NestJS DI. How the two signatures differ and which flag each stack needs.
TypeScriptTS2307 and TS2835: Cannot Find Module Under moduleResolution NodeNext
NodeNext models Node's real resolution, so .js belongs in the source import and exports maps decide what exists. Why bundler resolution hides both errors.
TypeScriptTypeScript strict Mode: TS2531, TS7006, and TS18047 Migrations
strict is nine flags at once. Count errors per code, fix them in the order that keeps the build green, and narrow instead of asserting.