代码、数据与二维码工具

YAML转JSON转换器

在浏览器中将单个YAML 1.2文档转换为JSON;限制别名展开,拒绝重复/复杂键、循环、非有限数和未知标签,并将不安全整数保留为字符串。

优先本地处理无需注册隐私说明 ↗

Enter one non-empty YAML 1.2 document. Maximum 100,000 characters.

使用步骤

如何使用

  1. Paste one YAML 1.2 document up to 100,000 characters.
  2. Choose compact JSON or pretty output with two- or four-space indentation.
  3. Convert, review the JSON, then copy it or download a .json file.

A bounded YAML 1.2 conversion

The parser accepts one YAML 1.2 document and rejects duplicate mapping keys, multiple documents, unknown tags, cycles, and alias expansion beyond 50 references. Comments are accepted but do not exist in JSON output. Merge keys are treated as ordinary YAML 1.2 keys rather than automatically merging objects.

Only JSON-safe values reach the result

Mappings must use scalar keys that can become unique JSON object keys. Complex keys, NaN, and Infinity are rejected. Integers outside JavaScript’s safe range are emitted as JSON strings so their digits stay exact. The conversion runs locally and does not execute YAML content as code.

常见问题

你可能还想知道

Can I convert a multi-document YAML stream?

No. Enter exactly one YAML document so the page can produce one unambiguous JSON root value.

Are anchors and aliases supported?

Ordinary aliases can be expanded up to the safety limit. Cycles and excessive expansion are rejected because JSON cannot represent them safely.

What happens to YAML comments?

They are discarded because JSON has no comment syntax.