JSON 格式化器
在线格式化、压缩或排序 JSON。免费、隐私本地化、100% 客户端运行。支持 2 空格缩进美化、单行压缩、递归按键排序,遇到语法错误会精确定位行号与列号,适合调试 API 响应、配置文件与数据交换格式。
尝试示例:
Local only
最近历史
暂无历史
使用方法
- 将 JSON 粘贴到输入框中。
- 选择格式化、压缩或排序键模式。
- 复制或下载结果。
使用此工具的任务
Apply JSON Patch (RFC 6902) 操作
JSON Patch defines 序列的 操作 (添加, 移除, 替换, move, 副本, 测试) 到修改 JSON document atomically. 任务
转换 CSV data to structured JSON
解析 a CSV table (with headers, quoted fields, embedded commas) into an array of JSON objects for programmatic access. 任务
转换 .env files to JSON
.env files 存储关键=VALUE pairs 为环境配置. Convert 到 JSON 为 structured access, 类型 casting, 和 validation. 任务
转换 INI configuration files to JSON
INI files use sections 在 brackets 和键=值 pairs. Convert 到 JSON 为编程式 access, validation, 和 interoperability 具有现代 tools. 任务
生成 TypeScript interfaces from JSON data
Infer TypeScript types 从 JSON 样本所以你 能够类型 API responses 无 hand-writing interfaces. 任务
转换 JSON to YAML and back without losing data
Translate 之间 JSON 和 YAML 为配置 files, preserving nested structures, arrays, 和标量 types across round-trip. 任务
转换 Apple plist files to JSON
Apple 属性 lists (plist) 序列化数据在 XML 或二进制格式化. Convert 到 JSON 为 cross-平台 use 和 easier manipulation. 任务
转换 Java .properties files to JSON
Java。properties files use 键=值 pairs 具有 dot-notation 为 nesting. Convert 到 JSON 为 use 在 JavaScript environments 和 structured access. 任务
转换 TOML configuration to JSON
解析 a TOML config file (used by Rust, Python projects) into JSON for tooling that expects JSON input. 任务
转换 XML to JSON and back
Translate 之间 XML 和 JSON 为 interoperability 具有遗留 APIs, preserving attributes, namespaces, 和 mixed 内容. 任务
转换 XML to YAML
转换 XML documents to YAML for more readable configuration files. YAML's indentation-based syntax is cleaner than XML's tags for human-authored data. 任务
编码 binary data into a JSON-safe string
转换 raw bytes (images, encrypted blobs, file contents) into a Base64 string that can be embedded inside a JSON field without breaking the structure. 任务
Format, 验证, 和 repair malformed JSON
Take JSON 字符串 (possibly minified, 具有 trailing commas, 或 comments) 和生成有效, indented JSON 具有错误 diagnostics. 任务
Infer JSON Schema 从样本数据
生成 a JSON Schema that describes the structure of a JSON instance, for validation and documentation. 任务
Inspect JWT 令牌: 解码头 和载荷无 verifying
Read 结构的 JSON Web Token 到 see 其 algorithm, claims, 和 expiry — purely 客户端-边, 否服务器 validation. 任务
在 JSON 与 YAML 之间迁移配置
将 JSON 配置转为 YAML(或反向),带格式化中间步骤,并在提交文件前了解类型强转陷阱。 任务
Apply JSON Merge Patch (RFC 7396)
JSON Merge Patch applies 部分 JSON object 到更新 document — 空 values delete 关键, 其他 values 替换它们. Simpler than JSON Patch. 任务
解析 JSON5 — JSON with relaxed syntax
JSON5 extends JSON 具有 comments, trailing commas, unquoted 关键, 单个 quotes, 和更多. Learn syntax extensions 和 conversion 到标准 JSON. 任务
解析 NDJSON (Newline-Delimited JSON)
NDJSON stores one JSON object per 行, enabling streaming 和行-通过-行过程. 常见在 logs, API streaming, 和大 数据 pipelines. 任务
解析 OAuth 2.0 token responses
OAuth 2.0 returns access_token, token_type, expires_in, 和 optionally refresh_token. Learn 到解析和 use 令牌响应正确. 任务
格式化压缩 JSON 以便阅读(和 diff)
把单行 API 响应转为缩进 JSON,并在输入根本不是合法 JSON 时给出精确错误位置。 任务
Stream JSON 数据为 内存-高效过程
Streaming JSON parsers 处理数据 incrementally 无 loading 整个 document 为内存. 必要为 大 JSON files 和实数-时间 APIs. 任务
解码嵌套的 URL 编码参数(查询字符串中的 Base64 JSON)
拆解 URL 参数承载 URL 编码 Base64 JSON 这一常见 API 模式——一条链、三个工具、页面间零复制粘贴。 任务
Use JSON-LD 为 linked 数据和 SEO
JSON-LD (Linked 数据) serializes RDF triples 在 JSON, enabling 搜索 engines 到理解 entity relationships. Used 为 Schema.org structured 数据. 任务
Use JSON Pointer (RFC 6901) 到参考 values
JSON Pointer defines 字符串 syntax 为 identifying 特定值 在 JSON document using slash-separated 路径 tokens. 任务
Use MQTT topic 结构为 IoT messaging
MQTT topics use slash-separated hierarchies 具有 wildcards 为 subscription. Learn topic 设计, QoS 级别, 和 retained messages. 任务
Use TOML arrays 和数组的 tables
TOML supports arrays 的 primitives 和 arrays 的 tables. Learn syntax 为 inline arrays, multi-行 arrays, 和 [[表]] arrays 为 structured 数据. 任务
使用此工具的管道
通过 JSON 比较两份 YAML 配置
管道
为 URL 传输编码 JSON 载荷
管道
HJSON 转 JSON 格式化
管道
格式化 JSON 并计算完整性校验和
管道
JSON 格式化并验证
管道
格式化 JSON 并生成 TypeScript 接口
管道
校验、格式化后将 JSON 转 YAML
管道
JSON5 转 JSON 格式化
管道
JSONC 转 JSON 格式化
管道
解码并格式化 JWT 载荷
管道
解析查询字符串并格式化 JSON
管道
TOML 转 JSON
管道
经 JSON 将 TOML 转 YAML
管道
解码嵌套 URL 参数(Base64 JSON)
管道
从 YAML 生成 TypeScript 接口
管道
常见问题
- 如何美化打印 JSON?
- 粘贴你的 JSON 并选择格式化模式,即可获得 2 空格缩进、每键一行的输出。
- 可以对对象键排序吗?
- 可以。选择排序键模式,会按字母顺序递归排列对象键,同时保持数组顺序不变。嵌套对象也会被排序。
- 压缩模式做什么?
- 压缩会移除所有可选空白,生成最短的单行合法 JSON。适合在传输前减小载荷大小。
- 语法错误如何报告?
- 工具捕获 JSON.parse 错误并提取位置,报告行号和列号,例如“Syntax error at line 3, column 12”。
- 工具会保留数字精度吗?
- 数字由 JavaScript 引擎解析并重新序列化。超过 Number.MAX_SAFE_INTEGER(2^53 - 1)的大整数可能丢失精度,请用字符串表示此类值。
- 输出可以安全嵌入 HTML 吗?
- 输出是纯文本。将 JSON 嵌入 HTML 时,请用 <script type="application/json"> 标签包裹,或转义 < 和 & 以防 XSS。
相关工具
JSON 验证器
验证 JSON 并按行列定位语法错误。免费、隐私本地化、100% 客户端运行。 工具
YAML 转换器
在线在 YAML 与 JSON 之间转换。免费、隐私本地化、100% 客户端运行。支持嵌套映射、序列、标量(字符串/数字/布尔/null)和带引号字符串,适合配置文件转换、CI/CD 流水线定义和 Kubernetes 清单处理。 工具
CSV 转换器
在线在 CSV 与 JSON 之间转换。支持逗号、分号和制表符分隔符。免费、隐私本地化、100% 客户端运行。CSV 转 JSON 时第一行作为表头生成对象数组;JSON 转 CSV 时提取键作为表头,适合数据迁移、API 响应转换和电子表格数据交换。 工具
Base64 编码器
将文本或二进制数据编码为 Base64。免费、隐私优先、100% 纯客户端运行。支持 UTF-8、ASCII、Latin1、UTF-16LE 字符集,可处理多语言文本与二进制内容,结果可直接用于 Data URI、邮件附件、JWT 等场景。 工具
大小写转换器
在 UPPER、lower、Title、camelCase、PascalCase、snake_case、kebab-case、CONSTANT_CASE 和 Sentence case 等格式之间转换文本。免费、隐私本地化、100% 客户端运行。自动识别混合输入(如 hello_worldFoo),按空格/下划线/连字符/大写边界拆分,适合变量命名、API 字段、CSS 类名和常量定义的格式转换。 工具