跳到主要内容
uencoder

JSON 格式化器

在线格式化、压缩或排序 JSON。免费、隐私本地化、100% 客户端运行。支持 2 空格缩进美化、单行压缩、递归按键排序,遇到语法错误会精确定位行号与列号,适合调试 API 响应、配置文件与数据交换格式。

尝试示例:
Local only

最近历史

暂无历史

使用方法

  1. 将 JSON 粘贴到输入框中。
  2. 选择格式化、压缩或排序键模式。
  3. 复制或下载结果。

使用此工具的任务

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?
粘贴你的 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。

相关工具