Skip to content

JSON ↔ YAML Converter

Convert JSON to YAML and YAML to JSON in your browser with a safe parser, line and column error messages, format, minify, swap and download.

Developer Runs client-side Free to use
Jump to the tool
Share: X WhatsApp
Loading JSON ↔ YAML Converter…

About the JSON ↔ YAML Converter

JSON ↔ YAML Converter turns JSON into readable YAML and YAML back into valid, formatted JSON. Nested objects, arrays, booleans, null, numbers and strings are carried across correctly, and strings that could be mistaken for other types — such as "true", "123" or "null" — are quoted in the YAML output so their type is preserved.

YAML is read with js-yaml using its core schema, bundled on this site. Custom or executable tags such as !!js/function or !!python/object are rejected rather than run, and dates stay plain strings. Comments, anchors and the original layout of a YAML file are not preserved in the converted output. Errors show the line and column where the problem was found.

How to use

  1. Choose JSON → YAML or YAML → JSON, or click Sample JSON / Sample YAML to try an example.
  2. Paste your document into the input editor.
  3. Pick 2 or 4 spaces of indentation and click Convert.
  4. Use Format input to tidy the input, Minify JSON for compact JSON, or Swap to convert the result back the other way.
  5. Copy the output or download it as a .yaml or .json file.

Key features

  • Both directions: JSON → YAML and YAML → JSON.
  • Safe YAML parsing with the core schema — no custom tags, constructors or code execution.
  • Error messages with line and column numbers for invalid JSON or YAML.
  • Format, minify, swap, copy and download controls.
  • Type-preserving output: quoted strings stay strings, booleans and null stay typed.
  • Protection against very large alias expansions that could freeze the page.

Best practices

  • Validate configuration in the tool that will read it — YAML dialects and schemas differ between applications.
  • Keep comments in your original YAML file; converted output does not keep them.
  • Quote YAML values such as yes, no, on, off or version numbers if they must stay strings.
  • Convert one YAML document at a time — split files that contain several --- documents.
  • Avoid pasting secrets from production configs into any website.

Benefits

  • Move between JSON APIs and YAML config files in seconds.
  • Clear errors make broken indentation easy to find.
  • Private: nothing you paste leaves the browser.
  • No sign-up or install.

Frequently asked questions

Is the YAML parser safe?

It uses js-yaml with the core schema. Unknown or custom tags such as !!js/function are rejected with an error, and nothing in the YAML is executed.

Are YAML comments kept?

No. Comments, anchors and the original formatting are not part of the data, so they are not preserved when converting.

Why is "true" quoted in my YAML output?

Because it was a string in the JSON. Without quotes YAML would read it as the boolean true, so the converter quotes it to keep the type.

Are dates converted to date objects?

No. Values like 2026-10-28 stay plain strings, which matches how JSON stores them.

Can I convert a file with several YAML documents?

Not in one go. If the input has more than one document separated by ---, the tool asks you to convert them one at a time.

Is my data uploaded?

No. Parsing and conversion happen entirely in your browser.