Markdown & Convert

YAML to JSON

Parse YAML to JSON - mirrors the existing JSON to YAML tool.

YAML input

Options

JSON output

{
  "name": "Suparn",
  "roles": [
    "admin",
    "editor"
  ],
  "active": true,
  "joined": "2024-09-01T00:00:00.000Z",
  "profile": {
    "city": "Bangalore",
    "tags": [
      "next",
      "react",
      "ts"
    ]
  }
}

About this tool

Paste any YAML 1.2 document and get equivalent JSON. Pretty-printed by default with adjustable indentation. Supports anchors (&) and aliases (*), explicit type tags, and YAML's three null forms. Round-trips with the existing JSON to YAML tool for full back-and-forth conversion.

FAQs

Which YAML version is supported?

YAML 1.2 - the version Kubernetes, GitHub Actions, and Ansible target. YAML 1.1 quirks like 'yes' / 'no' being booleans don't apply.

How are anchors and aliases handled?

They're resolved during parsing - the JSON output contains the expanded value at every reference. The structure becomes a tree, not a graph, since JSON doesn't have a reference syntax.

Does it parse timestamps and dates?

ISO-8601 timestamps are parsed as JavaScript Date objects and serialised back as ISO strings in JSON (JSON has no native date type - strings are the standard workaround).

What if my YAML has multiple documents?

A file with --- separators contains a stream of documents. The tool emits a JSON array, one entry per document. Single-document YAML stays as a plain object or array.

What's the round-trip with json-to-yaml?

Convert JSON → YAML → JSON and you'll get an identical document for plain scalar / map / sequence types. Date and binary values may downgrade to strings depending on the YAML emitter's choices.

Other tools