Home YAML to JSON

YAML to JSON Converter

Paste YAML and get clean, indented JSON instantly — with strict validation, copy and download, 100% in your browser.

Input YAML

JSON Output

What is JSON?

JSON (JavaScript Object Notation) is a lightweight, text-based data interchange format derived from JavaScript object literals. It represents data as objects ({ }), arrays ([ ]), strings (double-quoted), numbers, booleans (true/false) and null. JSON is the de facto standard for REST APIs, NoSQL document stores (MongoDB, CouchDB), configuration files and embedded data, because nearly every programming language has a fast, native JSON parser.

Unlike YAML, JSON strictly requires double-quoted strings, commas between elements, and braces to delimit structure. This makes it more verbose but also more deterministic and simpler to parse — which is why it dominates machine-to-machine communication.

Why convert YAML to JSON?

YAML and JSON describe the same data structures — objects, arrays, strings, numbers, booleans and null — so conversion between them is lossless for the JSON data model. You might want to convert YAML to JSON for several reasons:

  • API consumption. Most APIs speak JSON. Converting a YAML config to JSON lets you feed it directly to a client or service that expects JSON.
  • Tooling. Many libraries, linters and CI tools only accept JSON. Converting lets you reuse YAML-authored data in JSON-only pipelines.
  • Programmatic parsing. Every language ships a native JSON parser, while YAML parsers are less ubiquitous. JSON is faster and safer to parse.
  • Embedding in JavaScript. JSON is valid JavaScript, so converted output can be pasted straight into source code.

Conversely, if a human needs to read or hand-edit the data, YAML is usually the better choice. The two formats are complementary — converting lets you use each where it shines.

How the conversion works

This tool runs a built-in YAML parser (no external libraries) that walks the indentation-based structure and emits the equivalent JSON. The parser understands the most common YAML constructs:

  • Mappings (key: value) become JSON objects. Each key is decoded as a string; values may be scalars, nested mappings or sequences.
  • Sequences (lines starting with - ) become JSON arrays. Items may be scalars, nested mappings or further sequences.
  • Scalars are typed automatically: true/false/yes/no become booleans, null/~ become null, integers and floats become numbers, and everything else becomes a string.
  • Quoted strings. Double-quoted ("...") and single-quoted ('...') strings are always treated as strings, with escape sequences decoded.
  • Flow style. Inline arrays [a, b, c] and inline objects {a: 1, b: 2} are supported.
  • Comments. Lines starting with # and trailing # ... comments are ignored.

Indentation must use spaces (never tabs, which YAML forbids). The output is pretty-printed with two-space indentation and is valid JSON that round-trips cleanly through any JSON parser.

When to use YAML vs JSON

Both formats have their strengths. Choose based on how the data will be used:

  • Use YAML for configuration files, CI/CD pipelines, infrastructure-as-code manifests, documentation snippets, and any case where humans will read and edit the file by hand.
  • Use JSON for API payloads, NoSQL document storage, inter-service communication, embedded data in JavaScript, and any case where machine parsing and small size matter most.

A practical workflow is to author data by hand in YAML, then convert it to JSON whenever a machine needs to consume it. This keeps the human editing experience pleasant while still giving machines a fast, strict format to parse.

Limitations to be aware of

This converter covers the common YAML subset used by the vast majority of configuration files, but YAML has features that JSON cannot represent. A few things to keep in mind:

  • Multi-line strings. Block scalars (| literal and > folded) are parsed as their raw content; the resulting JSON string will contain real newlines escaped as \n.
  • Anchors and aliases. YAML references (&anchor / *alias) are not supported — duplicate the structure inline instead.
  • Tags and custom types. YAML's rich type system (sets, ordered maps, dates, custom tags) is reduced to the core JSON types.
  • Comments. JSON has no comments, so any comments in the YAML are dropped from the output.
  • Multiple documents. A single YAML stream separated by --- is parsed as one document; use only the first.

For most use cases — Kubernetes manifests, Docker Compose files, GitHub Actions workflows, application config — the converted JSON is ready to use as-is.

Is this YAML to JSON converter free?

Yes, completely free with no sign-up, no limits beyond your device's memory, and no upload — everything runs locally.

Will invalid YAML be converted?

No. The tool validates the YAML first and shows a parse error if it is invalid. Fix the YAML and convert again.

Does the parser support tabs for indentation?

No. YAML forbids tabs for indentation — use spaces only. The parser will report an error if it encounters a tab.

Can I convert JSON back to YAML?

Yes. Use the companion "JSON to YAML" tool on this site to convert in the other direction.

Is my data uploaded?

No. All parsing and conversion happens in your browser. Your YAML never leaves your device.