YAML ↔ JSON Converter — Free, Instant, No Upload
Convert between YAML and JSON instantly. Paste your YAML to get clean JSON, or paste JSON to get readable YAML. Supports nested objects, arrays, and custom indentation. Everything runs in your browser — nothing is sent to a server.
How to use this tool
- Paste your YAML into the input field.
- Preview the JSON output.
- Copy the converted JSON.
About YAML ↔ JSON Converter
This tool converts between YAML and JSON in both directions. In YAML to JSON mode it parses the text you paste and emits a JSON representation; in JSON to YAML mode it parses your JSON and renders it as YAML. You switch direction with the two mode buttons at the top, and a radio control lets you choose two or four spaces of indentation for the output. Both formats describe the same kinds of data, so the conversion preserves nested objects, arrays, strings, numbers, booleans, and null values across the round trip.
The conversion is backed by the js-yaml library, a widely used YAML 1.2 implementation. When converting YAML to JSON, the parser resolves the usual scalar types, so unquoted true becomes a boolean, 42 becomes a number, and an empty value or the literal null becomes JSON null. Block sequences turn into JSON arrays and mappings turn into JSON objects with no manual cleanup required. When converting JSON to YAML, the same engine serializes your structure into readable block-style YAML using the indent width you selected.
Errors are surfaced rather than hidden. If your YAML has an indentation mistake, a tab where spaces are required, or a duplicate key, the underlying parser message is shown in a red panel so you can locate the problem. Likewise, malformed JSON in the reverse direction reports the parse failure. An empty input simply shows nothing. Everything runs locally in your browser, so the documents you paste never leave your machine.
The tool handles a single YAML document per conversion. If you paste a multi-document stream separated by --- markers, only the first document is converted. It is a fast way to move a Kubernetes manifest, a CI pipeline file, or an application config between the two formats, to make a dense JSON payload readable as YAML, or to validate that a hand-written YAML file actually parses the way you expect.
Frequently Asked Questions
- Which directions does the converter support?
- Both. The YAML to JSON button parses YAML and outputs JSON, and the JSON to YAML button parses JSON and outputs YAML. You toggle between them at the top of the tool, and the input label updates to tell you which format it currently expects.
- What YAML features are supported?
- It uses the js-yaml library, so standard YAML features work: block mappings and sequences, flow collections, quoted and unquoted scalars, multi-line strings, booleans, numbers, and null. Unquoted scalars are resolved to their natural JSON types, so true becomes a boolean and a number stays a number rather than a string.
- Can it convert multi-document YAML?
- The tool processes a single document. If your input contains several documents separated by --- markers, only the first one is converted. Split the stream and convert each document individually if you need all of them.
- Can I control the indentation of the output?
- Yes. A radio control lets you choose between two and four spaces of indentation, and the setting applies to both the JSON output and the YAML output. Pick whichever matches your project's style conventions.
- How are types like numbers, booleans, and null handled?
- YAML scalars are resolved during parsing, so 42 becomes a JSON number, true and false become booleans, and an empty value or the literal null becomes JSON null. Going the other way, those same JSON types are written back as their YAML equivalents.
- What happens if my YAML or JSON has a syntax error?
- The parser's error message is displayed in a highlighted panel instead of silently producing nothing or wrong output. YAML errors commonly come from inconsistent indentation, tab characters, or duplicate keys; JSON errors usually come from trailing commas or unquoted keys.
- Will comments in my YAML be preserved?
- No. JSON has no concept of comments, so when YAML is parsed into a data structure and re-emitted, comments are not carried through. This is a limitation of the formats themselves rather than the tool.
- Is anything sent to a server?
- No. Parsing and conversion run entirely in your browser, so the documents you paste are never uploaded.
Embed this tool on your site
Free. One line of HTML — the tool runs in your visitor's browser, no data sent to anyone.
<iframe src="https://brevio.pro/embed/yaml-to-json" width="100%" height="600" loading="lazy" style="border:1px solid #e5e5e5;border-radius:8px" title="YAML ↔ JSON Converter — brevio"></iframe> <p style="font:12px/1.4 sans-serif"><a href="https://brevio.pro/tools/yaml-to-json">YAML ↔ JSON Converter</a> by <a href="https://brevio.pro">brevio</a></p>