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
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
Click YAML to JSON
Press the YAML → JSON button. The JSON appears in the right panel, pretty-printed with two-space indentation.
- 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
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
| Term | What it means here |
|---|---|
| Mapping | A set of key: value pairs in YAML; becomes a JSON object in curly braces |
| Sequence | A list written with leading dashes (- item) or [a, b]; becomes a JSON array |
| Scalar | A single value such as a string, number, boolean or null |
| Block scalar | A 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
Paste the YAML into the left panel and click YAML → JSON. The converted JSON appears in the right panel with two-space indentation, ready to copy with the Copy JSON button.
Yes. Paste JSON into the right panel and click JSON → YAML. The YAML panel is replaced with the converted result, and strings that would otherwise be read as numbers or booleans, such as "123" or "yes", are quoted so they stay strings.
No. The js-yaml library is loaded into your browser and both conversions run there, so configuration files with internal hostnames or settings never leave the page.
The most common causes are tab characters used for indentation, which YAML forbids, inconsistent indentation between sibling keys, and duplicate keys in the same mapping. The error message names the problem and, for most errors, the line and column.
No. JSON has no comment syntax, so comments are dropped during conversion and cannot be recovered by converting back to YAML. Keep the original YAML file if the comments matter.
Anchors (&name) and aliases (*name) are resolved, so the JSON contains a full copy of the value wherever the alias appeared. The << merge key is not merged by this parser; it is kept as a literal "<<" key in the JSON output.
No. The converter reads a single document, so a file with more than one document separated by --- returns an error. Convert each document separately.
No. The parser follows the YAML 1.2 core rules, so only true and false (written in lowercase, Capitalized or ALL CAPS) become JSON booleans, while yes, no, on and off stay strings. Older YAML 1.1 tools may read them differently, so quote them in your source if the type matters.
A date such as 2024-01-15 stays a string. Integers, decimals, octal (0o17) and hex (0x1F) become JSON numbers, ~ or null becomes null, and .inf or .nan become null because JSON cannot represent them. Integers larger than about 9 quadrillion lose precision in JSON.
They describe the same data: objects, arrays, strings, numbers, booleans and null. JSON uses braces, brackets and quotes and is the standard format for APIs. YAML uses indentation and dashes, allows comments, and is easier to edit by hand, which is why tools like Kubernetes, Docker Compose and GitHub Actions use it for configuration.
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.
