Text & Data Tools013

YAML to JSON Converter

Turn config files, CI pipelines and Kubernetes manifests into JSON, with errors that point at the line.

or drop a file on the input
Indent

Paste YAML, open a file or load the sample

Processed locally · 0 bytes sent

How to convert YAML to JSON

  1. Paste your YAML into the Input box, click Open file to pick a .yaml or .yml file, or drop the file onto the box. Load sample fills in an example.
  2. Choose the indent: 2 spaces, 4 spaces, or Minified for a single line.
  3. Read the JSON in the Output box. If the YAML is invalid, an error shows the line and column where parsing stopped.
  4. Click Copy to put the JSON on your clipboard, or Download .json to save it as a file.

Why use this tool

  • Config for tools that only read JSON

    Many libraries, APIs and test fixtures take JSON, while the config you have is YAML. Convert it once and paste the result where it is needed.

  • Checking what a manifest really says

    Kubernetes manifests, GitHub Actions workflows and Docker Compose files rely on indentation, anchors and merge keys. The JSON shows the structure the parser actually sees, so a mis-indented key stands out.

  • Validating YAML before a deploy

    A tab, a missing space after a colon or a duplicated key breaks a pipeline. Paste the file first: if it does not parse, the error points at the line to fix.

Private by design

Whatever you paste or drop here is parsed in this browser tab and never uploaded, so exports holding customer records, tokens or internal URLs stay on your device. No account needed.

Good to know

Multiple documents. A file with several documents separated by ---, as Kubernetes manifests often are, becomes a JSON array with one item per document. A single document becomes its own value.

How YAML values map to JSON. Parsing follows YAML 1.2 rules (the js-yaml library).

  • Only true and false (in lower case, Title case or upper case) are booleans. yes, no, on and off stay strings, so the country code NO stays "NO".
  • ~, null and an empty value become null. .inf and .nan also become null, because JSON has no infinity or NaN.
  • Dates and timestamps become ISO 8601 strings in UTC: 2026-11-10 becomes "2026-11-10T00:00:00.000Z". A time without a zone is read as UTC.
  • Numbers are written the JSON way: 1.0 becomes 1 and the hex value 0x1F becomes 31.
  • Anchors and aliases (&base, *base) and merge keys (<<: *base) are expanded, so the JSON holds the full values.
  • Comments are dropped, since JSON has no comments. Key order is kept.

Errors. Invalid YAML, a duplicated key, or a tab used for indentation shows an error with the line and column where the parser stopped. The real mistake is often on that line or the one above it.

Example

In — Two YAML documents

service: api
replicas: 2
ports:
  - 8080
env:
  DEBUG: false
---
service: worker

Out — JSON array, 2-space indent

[
  {
    "service": "api",
    "replicas": 2,
    "ports": [
      8080
    ],
    "env": {
      "DEBUG": false
    }
  },
  {
    "service": "worker"
  }
]

Frequently asked questions

Does it handle files with several YAML documents?

Yes. Documents separated by --- are converted into a JSON array, one item per document, in the order they appear. The status line tells you how many documents were found.

Why does my YAML give an error on a line that looks fine?

The parser reports where it noticed the problem, which can be after the mistake. Check that line and the one above it for a tab instead of spaces, a missing space after a colon, an unclosed quote or bracket, or a key indented differently from its siblings.

Are YAML comments kept in the JSON?

No. JSON has no comment syntax, so comments are dropped. Everything else, including key order, is kept.

Will yes and no turn into true and false?

No. This converter follows YAML 1.2, where only true and false are booleans. yes, no, on and off stay strings, which avoids the classic problem of the country code NO turning into false.

What happens to anchors and aliases?

They are expanded. An alias such as *defaults is replaced by a copy of the anchored value, and merge keys (<<) copy the anchored keys into the mapping, so the JSON is self-contained.