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
- Choose JSON → YAML or YAML → JSON; the swap button reverses the direction.
- Paste your data, or load the Docker Compose, Kubernetes Pod or GitHub Actions sample.
- Pick 2- or 4-space indentation.
- If an error appears under the panels, fix the line and column it names.
- 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?
Can all JSON files be converted to YAML?
Can YAML contain comments that JSON does not support?
Why are some strings quoted in the YAML output?
What is the best indentation standard for YAML?
Page last updated . Found a wrong result or a mistake on this page? Let us know.
Related tools
Regex Builder
Build a regular expression from blocks, with live matches.
Chmod Permissions Calculator
Work out chmod values from checkboxes, octal or ls -l strings.
CSS Box Shadow Generator
Multi-layer CSS box shadows with live preview and Tailwind export.
Glassmorphism Generator
Design frosted-glass panels and copy the CSS or Tailwind classes.