ToolJutsu
All tools
Developer Tools

YAML to JSON

Convert YAML into JSON.

0 B
Tip: press Ctrl/ + Enter
Processed on your device. We never see your files.

How to use YAML to JSON

What this tool does

This tool reads a YAML document and rewrites it as JSON. YAML and JSON describe the same kinds of data — objects (mappings), arrays (sequences), strings, numbers, booleans and null — but YAML is designed to be written by hand, while JSON is the format most APIs, build tools and JavaScript code actually consume. The converter parses your YAML, builds the equivalent data structure, and serialises it as clean, pretty-printed JSON with the indentation you choose. Everything happens in your browser; no file is uploaded.

Why you might need it

YAML is everywhere in modern tooling: CI pipelines, Kubernetes manifests, Docker Compose files, Ansible playbooks and application config all use it. But plenty of programs only speak JSON. You might need to feed a YAML config into a JSON-only API, paste a fixture into a JavaScript test, validate a manifest with a JSON Schema tool, or simply read a deeply nested YAML file in a format where the brackets make the structure unambiguous. Converting to JSON also flushes out hidden problems — anchors, aliases and type coercion all get resolved, so what you see is exactly what a parser will see.

How to use it

  1. Paste your YAML into the input box, or drop a .yaml or .yml file onto it.
  2. Choose the JSON indentation: 2 spaces, 4 spaces, or tabs.
  3. Click Convert to JSON, or press Ctrl/Cmd + Enter.
  4. The JSON appears below; use the copy button to grab it.
  5. If the YAML is malformed, a clear error names the line and column to fix.

The Load sample button drops in a small YAML document so you can see the conversion immediately, and the byte counters show how the size changes.

Common pitfalls

The number-one source of errors is indentation. YAML uses spaces to express nesting, and it does not allow tab characters for indentation — a tab pasted from another editor will break parsing even though it looks fine. Keep indentation consistent: two spaces per level is the usual convention.

The second surprise is type coercion. YAML guesses types from unquoted text. yes, no, true, false, on and off all become booleans; a bare 123 becomes a number; an empty value or null becomes JSON null. A version string like 1.10 written without quotes parses as the number 1.1. If a value must stay a string — a ZIP code, a country code, a version — quote it in the YAML before converting. Finally, this tool converts one document; a file with --- separators holds several, and only the first is read.

Tips and advanced use

When you are debugging a config that “should work”, converting it to JSON is a fast sanity check: the JSON output shows the exact structure the YAML parser produced, including any anchors that were expanded, so a misplaced key jumps out immediately. Round-tripping is useful too — convert YAML to JSON here, then back again, and compare; if a value changed, you have found an unintended type coercion. Because the conversion is fully client-side, you can safely process manifests that contain access tokens, database URLs or internal service names without any of it leaving your machine.

Frequently asked questions

Is my YAML sent to a server?
No. The YAML is parsed and converted to JSON entirely inside your browser using JavaScript. Nothing is uploaded, so it is safe to convert configuration files that contain secrets or internal hostnames.
Why does my YAML show as invalid?
YAML is whitespace-sensitive, so the most common cause is inconsistent indentation or a stray tab character — YAML forbids tabs for indentation. The error message includes the line and column where parsing first failed, so start there.
How are YAML data types converted to JSON?
Scalars map directly: strings, numbers, booleans and null become their JSON equivalents. Mappings become JSON objects and sequences become JSON arrays. Comments and anchors are resolved during parsing and do not appear in the output.
Can it handle multi-document YAML files?
This tool converts a single YAML document. If your file uses --- separators to hold several documents, only the first is converted; split the file and convert each document on its own.
Why did my unquoted value change type?
YAML infers types from unquoted text, so yes, no, on and off become booleans and a value like 1.0 becomes a number. If you need a value to stay a string, wrap it in quotes in the YAML source before converting.

Related tools