Conversion Tools

YAML to JSON

Convert YAML to JSON, or JSON back to YAML, from the same page with The Tools Kit's free converter. It uses the js-yaml library in your browser, so nothing is uploaded: the JSON comes out with two-space indentation, and invalid input gets a parser error showing the line and column.

Runs in your browser. Your files and text never leave your device - nothing is uploaded.

Convert YAML to JSON Online

The Tools Kit's free YAML to JSON converter turns a YAML document into clean, indented JSON, and turns JSON back into YAML from the same page. Paste a Kubernetes manifest, a Docker Compose file, a GitHub Actions workflow or any other YAML config, click one button, and copy the result. It works as a YAML parser and validator too: if the input is not valid YAML, you get the parser's own error message instead of a silent failure.

Conversion uses the open-source js-yaml library, loaded into your browser on demand. Nothing is sent to a server, so it is safe to paste configuration that contains internal hostnames or service names.

How to Use the YAML to JSON Converter

  1. 1

    Paste your YAML

    Paste or type YAML into the left panel. A short sample with a name, an age and a list of tags is loaded so you can see the expected shape.

  2. 2

    Click YAML to JSON

    Press the YAML → JSON button. The JSON appears in the right panel, pretty-printed with two-space indentation.

  3. 3

    Fix any reported errors

    If the YAML cannot be parsed, an "Invalid YAML" message explains what the parser objected to, usually with the line and column.

  4. 4

    Convert back or copy

    Edit the JSON and press JSON → YAML to convert it back, or use Copy JSON or Copy YAML to take the result to your editor.

There is no account and no usage limit. If you want to tidy or minify the JSON afterwards, paste it into the JSON formatter.

YAML vs JSON: The Same Data, Two Syntaxes

YAML and JSON describe the same structures. A YAML mapping becomes a JSON object, a list of dashed items becomes a JSON array, and plain values become strings, numbers, booleans or null. The sample loaded in the tool shows the conversion:

name: Alice
age: 30
tags:
  - admin
  - user
{
  "name": "Alice",
  "age": 30,
  "tags": [
    "admin",
    "user"
  ]
}

JSON is stricter: every string is quoted, objects need braces and commas, and there are no comments. That makes it the default for APIs and data exchange. YAML relies on indentation, allows comments, and is easier to write by hand, which is why so many deployment and CI tools use it for configuration. If your data is tabular rather than nested, the JSON to CSV converter can take the JSON one step further into a spreadsheet.

How YAML Values Are Converted

The parser follows YAML 1.2 core rules, which avoid some surprises older parsers are known for. These are the cases that most often trip people up:

  • Booleans: only true and false (lowercase, Capitalized or ALL CAPS) become JSON booleans. yes, no, on and off stay strings.
  • Numbers: 30, 1.5, 0x1F (31) and 0o17 (15) become numbers. Quote a value such as "007" to keep its leading zeros.
  • Null: ~, null and an empty value become null. .inf and .nan also become null because JSON has no infinity or NaN.
  • Dates: 2024-01-15 stays a string; it is not turned into a timestamp.
  • Multi-line strings: a | block keeps its line breaks as \n, while a > block folds lines into one line joined by spaces.
  • Anchors and aliases: *alias references are expanded into full copies. The << merge key is not merged and appears as a literal "<<" key.
  • Comments: dropped, because JSON cannot hold them.

Going the other way, JSON to YAML quotes strings like 'yes' or '123' so that another parser will not read them as booleans or numbers.

Fixing Invalid YAML Errors

When the YAML cannot be parsed, the tool shows "Invalid YAML" followed by the parser's explanation and, for most errors, the line and column with a pointer to the problem. The usual causes are:

  • Tabs in indentation: YAML only allows spaces. An editor that inserts tabs breaks a file that looks aligned.
  • Inconsistent indentation: sibling keys must line up at the same depth.
  • Duplicate keys: the same key twice in one mapping is rejected rather than silently overwritten.
  • Multiple documents: a --- separator followed by a second document is not supported; convert each document on its own.
  • Unquoted special characters: a value starting with characters such as @, `, or containing ": " may need quotes.

Kubernetes Secrets store their values base64-encoded, so after converting a Secret manifest you can read a value with the Base64 decoder.

Common uses

  • Converting a Kubernetes manifest, Helm values file or CI pipeline to JSON for a tool or API that only accepts JSON
  • Turning a JSON API response into readable YAML for a config file
  • Checking that hand-written YAML parses into the structure you expected
  • Comparing config formats alongside other data formats, for example with the XML to JSON converter or the JSON to XML converter
  • Building a request body from a YAML spec, then testing it with a command from the cURL converter
  • Importing spreadsheet data as JSON with the CSV to JSON converter and turning it into YAML here

More format tools are collected on the conversion tools page.

YAML terms explained

TermWhat it means here
MappingA set of key: value pairs in YAML; becomes a JSON object in curly braces
SequenceA list written with leading dashes (- item) or [a, b]; becomes a JSON array
ScalarA single value such as a string, number, boolean or null
Block scalarA multi-line string introduced by | (keeps line breaks) or > (folds lines into spaces)
Anchor and alias&name marks a value and *name reuses it; the converter expands every alias into a full copy
Document marker--- separates documents in one YAML file; this converter accepts a single document only

Frequently Asked Questions

Reviewed by Raja Jahangir · Last reviewed: October 7, 2026

How do you convert YAML to JSON?

To convert YAML to JSON, paste the YAML in the left panel and click YAML to JSON; the result is pretty-printed with two-space indentation. Paste JSON on the right and click JSON to YAML to convert back. Parsing uses the js-yaml library in the browser, so nested maps, lists, and quoted strings are handled and syntax errors are reported.

What is the difference between YAML and JSON?

YAML and JSON describe the same data structures: maps, lists, strings, numbers, and booleans. JSON uses braces, brackets, and quotes and is the standard for APIs. YAML uses indentation and dashes, allows comments, and is easier to write by hand, which is why Docker Compose, Kubernetes, and GitHub Actions use it for configuration.

Sources and standards