Skip to content
T
Tools.Town
Free Online Tools for Everyone
{ }

YAML to JSON

100% Free

Convert YAML config files to formatted JSON instantly in your browser. Handles block mappings, sequences, flow collections, comments, and typed scalars — no upload, no server.

Hand-rolled Parser
Typed Scalars
Flow + Block
100% Private

19 lines

17 keys

Embed This Tool

Easy to Embed

Add YAML to JSON to your website or blog in seconds.

  • Responsive design
  • Lightweight & fast
  • No backend required
  • Always up-to-date
<iframe
  src="https://tools.town/embed/yaml-to-json/"
  width="100%"
  height="600"
  style="border:none; border-radius:12px;"
  loading="lazy"
  title="YAML to JSON">
</iframe>

Share This Tool

Share Instantly

Share YAML to JSON with anyone — no login required.

  • Shareable link
  • No login required
  • Works on any device
  • No account needed

Share via

Advertisement

How to Use

  1. 1 Paste your YAML into the left editor — or click 'Load example' to start from a sample config
  2. 2 Choose your JSON indent: minified, 2 spaces, or 4 spaces
  3. 3 Optionally toggle 'Sort keys A–Z' to alphabetise every object key for clean diffs
  4. 4 Read the formatted JSON in the right pane — it updates as you type
  5. 5 Click 'Copy JSON' to copy the result, or 'Clear' to start over

Features

  • Hand-rolled YAML parser — no third-party libraries, runs entirely in your browser
  • Block mappings and indentation-based nesting to any depth
  • Block sequences of scalars and sequences of maps (- key: value)
  • Inline flow collections — [a, b, c] sequences and { a: 1 } mappings
  • Automatic scalar typing: integers, floats, booleans, null (null / ~ / empty), and quoted strings
  • Configurable indent and optional alphabetical key sorting for clean, diff-friendly output

Why it Matters

YAML is the default config format for Kubernetes, GitHub Actions, Docker Compose, Ansible, and most CI pipelines, but JSON-only APIs, log processors, and debuggers expect JSON. Converting between them by hand is slow and error-prone because YAML's whitespace rules and implicit typing are easy to get wrong. A precise, local converter shows you exactly how a parser reads your file so you can trust the structure before you ship it.

★★★★★

Use Cases

Debug CI & Kubernetes configs

See the exact data structure a parser reads from your GitHub Actions or K8s YAML

Feed JSON-only APIs

Turn a YAML config into the JSON body an endpoint or SDK expects

Migrate config formats

Move from YAML-based settings to a JSON store with sorted, diff-clean output

Validate structure quickly

Catch broken indentation and malformed YAML before it breaks a deploy

What this converter does

Paste any YAML configuration — a GitHub Actions workflow, a Docker Compose file, a Kubernetes manifest, or any settings file — and get clean, formatted JSON immediately. The parser is hand-rolled in JavaScript and runs entirely in your browser, so nothing is uploaded and the conversion is deterministic: the same input always produces the same output.

How scalars are typed

YAML resolves unquoted values by their look. 42 becomes a JSON number, 3.14 a float, true and false booleans, and an empty value, ~, or null all become JSON null. Anything wrapped in single or double quotes stays a string — so "123" stays the string "123", not the number 123. Quote any value you want preserved verbatim.

Block and flow styles

Both YAML notations are supported. Block style uses indentation and - bullets for nesting; flow style uses inline [a, b, c] sequences and { key: value } mappings. You can mix them — a block mapping can hold a flow sequence, and a sequence item can be a flow map.

Privacy

All parsing happens locally in your browser. Your YAML is never sent to a server.

Frequently Asked Questions

Which YAML features are supported?
A practical YAML 1.x subset: comments, block mappings (key: value), indentation-based nesting, block sequences including sequences of maps, inline flow sequences [a, b] and flow mappings { a: 1 }, single- and double-quoted strings with escapes, and automatic typing of integers, floats, booleans, and null (written as null, ~, or left empty). It parses the first document and ignores a leading --- marker.
Is my YAML uploaded anywhere?
No. The parser is written in JavaScript and runs entirely in your browser. Your configuration data never leaves your machine — there is no server round-trip.
Why did my number become a string (or vice versa)?
YAML resolves unquoted scalars by type: 42 becomes a number, true becomes a boolean, and empty or ~ becomes null. To force a value to stay a string, wrap it in quotes — "123" stays the string "123". Quote anything you want to keep verbatim.
Can I sort the keys in the JSON output?
Yes. Toggle 'Sort keys A–Z' to alphabetically sort every object key at every level. Sorted output diffs cleanly against an existing JSON file, which is handy during config migrations.
What happens with invalid YAML?
The converter throws a clear error naming the line and the problem — for example tab indentation, broken indentation, or a malformed flow collection — instead of silently producing wrong JSON.

Related Tools You Might Like

Browse more free tools