Convert YAML to JSON, or JSON to YAML
Paste your YAML or JSON
Pick the direction you need first.
Get the converted result
Updates live as you type.
Copy the output
One click copies the result.
Paste YAML or JSON and convert it to the other format instantly — useful for config files, OpenAPI/Swagger specs, API responses, and anywhere the two formats need to interoperate. Click the swap button to switch direction.
Handles YAML anchors and aliases (resolving them into their full expanded values), and rejects duplicate keys and tab-indented YAML with a clear error instead of silently producing wrong data. Note: this converts a single YAML document — a multi-document Kubernetes manifest (multiple resources separated by ---) will show a clear error rather than only converting the first one; split it into individual documents first.
Everything runs entirely in your browser using only the safe YAML schema, so untrusted YAML can't execute code through this tool, and nothing you paste is ever uploaded.
YAML and JSON, in either direction — click the swap button to switch between YAML-to-JSON and JSON-to-YAML.
Yes — an anchor (&name) and its alias (*name) are resolved and expanded into their full value in the JSON output, exactly as a real YAML parser is supposed to handle them.
No — JSON has no comment syntax at all, so any # comments in your YAML are dropped during conversion. This is a fundamental limitation of the JSON format itself, not something this tool could preserve.
Not directly — this tool converts a single YAML document. A file with multiple resources separated by --- (the standard way Kubernetes bundles several manifests in one file) will show a clear "expected a single document in the stream" error rather than silently converting just the first one. Split the file into individual documents first, then convert each separately.
You'll get a clear "duplicated mapping key" error. Some YAML tools silently keep only the last value when a key repeats, which can hide a real mistake in a config file — this one rejects it outright so you catch the problem instead of getting quietly wrong output.
YAML's specification doesn't allow tab characters for indentation, only spaces — this is a rule of the YAML format itself, not a limitation of this tool. If you paste YAML that was indented with tabs (common when copying from some editors), you'll see a specific error naming the exact line and column; re-indent that line with spaces (2 or 4 is standard) to fix it.
No — this tool only parses YAML using the safe default schema. Unsafe constructs some YAML parsers historically supported (like tags that instantiate arbitrary types or functions) are rejected outright with an error, not executed.
Common reasons: an API, CLI tool, or automation pipeline that only accepts JSON but your config is written in YAML; wanting to view an API's JSON response in YAML's more readable, less-punctuation format; or converting a Docker Compose or CI/CD config file for a tool that expects the other format.
They represent the same underlying data (objects, arrays, strings, numbers, booleans, null) — YAML is designed to be easier for humans to read and write (no braces or quotes required, indentation-based structure, supports comments), while JSON's stricter, more explicit syntax is what most APIs and programming languages parse natively.
Yes — that's exactly what the swap button does. This is one tool covering both directions, not two separate ones.
No — conversion happens entirely in your browser. Nothing you paste is sent to a server.
No artificial limit is enforced. Very large YAML or JSON documents just take a little longer to parse, since everything happens in your browser.
Yes — click "Load example" to fill the input with a small sample YAML document (with a nested list) and see the converted JSON immediately.
It's the reverse of what you might guess: any valid JSON document is also valid YAML (per the YAML 1.2 spec), but valid YAML is not generally valid JSON — YAML adds things JSON doesn't have, like comments, unquoted strings, and multi-document files. That asymmetry is exactly why a dedicated converter like this one is useful instead of just treating the two as interchangeable.
The standard tool is yq (mikefarah/yq): yq -o=json '.' file.yaml, or piped from stdin with cat file.yaml | yq -o=json '.'. (Older yq versions used a -j or --tojson flag — that's deprecated as of v4.16 in favor of -o json.) This tool does the same conversion without installing anything, which is often faster for a one-off file.
Yes — OpenAPI/Swagger specs are just YAML or JSON documents following a particular schema, so this tool converts them the same way as any other YAML file. This is one of the most common real reasons to need this conversion, since specs are often authored in YAML for readability but some tooling in the API pipeline expects JSON.
Python: import yaml, json; json.dumps(yaml.safe_load(open("file.yaml").read())) (using the PyYAML package). Java: Jackson's YAMLMapper can read YAML and re-serialize it with ObjectMapper as JSON. JavaScript/Node: the same js-yaml library this tool itself uses — JSON.stringify(yaml.load(yamlString)).
Not natively — Notepad++ has no built-in YAML-to-JSON conversion. You'd need a third-party plugin (like Encode/Decode or NppExec) installed first. For a one-off conversion, pasting into a tool like this one is usually simpler than installing a plugin.
Not currently — this tool is paste-only: open your file in any text editor, copy its contents, and paste them in. There's no file-picker or drag-and-drop upload yet.
It's a real trade-off, not a clear winner. YAML is meaningfully more token-efficient to generate — commonly cited figures put it around 15-18% fewer tokens than formatted JSON for the same data, since indentation replaces braces and quotes. But some evaluations find a real accuracy cost to that: YAML's whitespace sensitivity means a model that gets indentation slightly wrong produces invalid output, and a few studies report meaningfully lower generation/validation accuracy for YAML output versus JSON. In short: YAML costs less per response, JSON tends to come out correct more reliably — which one wins depends on whether you're optimizing for cost or correctness.
Convert numbers between binary, octal, decimal, and hexadecimal instantly. Type in any field and the others update live. Uses arbitrary-precision math, so very large numbers stay accurate. All processing happens in your browser.
Format, validate, and beautify JSON data instantly. Minify JSON, fix formatting errors, and validate JSON syntax online. Perfect for developers working with APIs and configuration files.