OneFreePlace
Developer Tools / Data Conversion / #334
#334 Developer Tool 100% local No sign-up

YAML → JSON

Convert YAML into strict JSON without quietly rounding large integers or losing anchors, aliases, merge keys and block strings. Every successful output is parsed again before download.

Verifiedstrict JSON round-trip check
YAML input
0 B
Drop one or many .yaml / .yml files here, or
JSON output
Waiting for YAML
The generated JSON is strict-parsed and compared with the converted YAML data before it is marked ready.
Input—
Output—
Nodes—
Depth—
Documents—
Large integers—

Conversion safety report

Designed around the places where YAML → JSON conversion usually changes meaning.

✓
Structure + key guardWaiting for input
✓
Exact numeric handlingLarge integers are never silently rounded
✓
YAML references resolvedAnchors, aliases and merge keys are tracked
✓
Strict JSON verifiedOutput is re-parsed before download

Batch results

—

YAML to JSON with data-loss checks built in

YAML can represent more than JSON: aliases can reuse nodes, merge keys can inherit mappings, block scalars have folding rules, custom tags can carry application-specific meaning, and YAML accepts numeric spellings JSON does not. This converter makes those differences explicit instead of silently guessing.

What makes this version different

  • Exact big integers: decimal, hexadecimal, octal and binary integers are normalized without first passing through a JavaScript Number. A 20-digit integer stays exact in the generated JSON text.
  • Anchors, aliases and << merges: common reusable YAML configuration patterns are resolved into normal JSON objects. Explicit keys correctly override merged defaults.
  • Block scalar support: literal | and folded > strings, including chomping indicators, become ordinary JSON strings with their line breaks preserved.
  • Multi-document YAML: several --- documents can become one JSON array or JSON Lines.
  • Duplicate-key protection: keys are checked after scalar normalization so collisions that JSON would collapse are stopped.
  • Strict output verification: the produced JSON is parsed by an independent strict JSON parser and compared with the converted data before download is enabled.
  • Batch workflow: process several YAML files locally and download all successful results together as a ZIP.

Worked example

YAML
defaults: &base
  retries: 3
  enabled: true
service:
  <<: *base
  name: api
  requestId: 900719925474099312345
  note: |
    local only
    no upload

JSON
{
  "defaults": {"retries": 3, "enabled": true},
  "service": {
    "retries": 3,
    "enabled": true,
    "name": "api",
    "requestId": 900719925474099312345,
    "note": "local only\nno upload\n"
  }
}

Choose the typing mode deliberately

YAML 1.2 Core recognizes YAML booleans, nulls and YAML number forms such as 0xFF. Date-looking text such as 2026-09-25 remains text. JSON schema is more conservative: only JSON-style true, false, null and JSON number syntax are typed automatically.

Large integers and non-finite numbers

JSON syntax itself can contain an integer larger than JavaScript's safe integer range, although some downstream programs may round it when they parse it. The default keeps the exact numeric token and warns you in the report. You can instead emit such integers as strings or stop the conversion. YAML's .inf and .nan have no JSON numeric equivalent, so the safe default is to stop; opt into string or null conversion only when that matches your target system.

Privacy and limitations

The converter runs in your browser and does not intentionally upload your input. It targets the data-oriented YAML 1.2 features most useful for configuration and interchange. Application-specific custom tags are rejected by default because dropping their semantics can change meaning; an explicit option lets you ignore the tag only when you know that is safe. Extremely specialized YAML constructs such as complex collection keys are intentionally rejected because JSON object keys must be strings.

FAQ

Will anchors and aliases survive?

JSON has no alias syntax, so aliases are expanded to their resolved values. Merge keys are resolved into normal object properties.

What happens to comments?

JSON has no comments, so YAML comments are not represented in the JSON result. Keep the original YAML when human annotations matter.

Why reject duplicate keys?

Different YAML parsers disagree on whether the first or last duplicate wins. Stopping the conversion avoids silent data loss.

Can it convert several YAML documents?

Yes. Choose JSON array for one standard JSON result, or JSON Lines when each YAML document should become one compact record.