Skip to content
TabBench

JSON to YAML Converter

Convert JSON to YAML and YAML to JSON with syntax validation, custom indentation, and config presets.

Runs in your browser. Nothing you add is uploaded.

What the JSON to YAML Converter does

Convert JSON to YAML or YAML to JSON, with the input and output side by side. Conversion uses js-yaml, a widely used YAML library, so block text (run: | in a CI file), quoted strings, anchors and multi-document files are handled properly rather than approximated. Strings that YAML would otherwise misread, such as 'yes', 'on', '-1' or a value containing ': ', are quoted automatically, and invalid input is reported with its line and column.

How to convert JSON to YAML and YAML to JSON

  1. Choose JSON → YAML or YAML → JSON; the swap button reverses the direction.
  2. Paste your data, or load the Docker Compose, Kubernetes Pod or GitHub Actions sample.
  3. Pick 2- or 4-space indentation.
  4. If an error appears under the panels, fix the line and column it names.
  5. Copy the result or download it as document.yaml or document.json.

The JSON to YAML Converter runs entirely in your browser — nothing you enter is uploaded, stored, or logged.

When to use it

Kubernetes manifests from kubectl

kubectl get deployment web -o json prints a live resource as JSON. Converting it to YAML gives the familiar manifest layout you can edit and commit. Remove the status block and server-set fields such as metadata.uid, resourceVersion and creationTimestamp before applying it again.

Seeing how a YAML file is really read

YAML guesses types: python-version: 3.10 becomes the number 3.1, and a postcode like 01234 becomes 1234. Converting YAML to JSON shows exactly how a YAML 1.2 parser types every value, which is the quickest way to debug a config that looks right but behaves wrongly. Quote anything that must stay a string.

JSON for tools that need it

JSON Schema validators, jq and many APIs accept only JSON, even when your team keeps the same configuration in YAML. Converting preserves the structure exactly, and the JSON Formatter can then validate or pretty-print the result.

Good to know

  • Comments do not survive YAML → JSON, because JSON has no comment syntax. Keep the YAML as the source of truth if its comments matter.
  • A YAML stream with several documents separated by --- becomes a JSON array with one element per document.
  • YAML is read with YAML 1.2 rules, where yes, no, on and off are plain strings. Older YAML 1.1 tools treat them as booleans, so JSON → YAML quotes them to be safe.
  • Anchors and aliases (&base, *base) are expanded into full copies in the JSON; going back, repeated blocks are written out in full rather than as anchors.
  • Dates such as 2024-01-01 stay strings in the JSON instead of being turned into timestamps.

Frequently asked questions

What is the difference between JSON and YAML?

JSON is a strict data interchange format based on curly braces and brackets. YAML is a human-readable superset that uses whitespace indentation, supports comments, and omits bulky punctuation.

Can all JSON files be converted to YAML?

Yes. All valid JSON is structurally valid YAML. YAML allows cleaner configuration without quotation marks or closing tags.

Can YAML contain comments that JSON does not support?

Yes. YAML supports # comments; JSON has none. Converting YAML to JSON drops them, and converting back cannot restore them.

Why are some strings quoted in the YAML output?

Because unquoted they would be read as something else: '-1' as a number, 'yes' or 'on' as true by YAML 1.1 parsers, 'x: y' as a key and value, and an empty value as null. Quoting keeps them strings in every parser.

What is the best indentation standard for YAML?

Two spaces is the norm for Kubernetes, Ansible, Docker Compose and GitHub Actions. YAML forbids tab characters for indentation, so always use spaces.

Page last updated . Found a wrong result or a mistake on this page? Let us know.