JSON to YAML Converter

Convert JSON to tidy YAML for Kubernetes manifests, Docker Compose, GitHub Actions and other config files. It runs locally, so nothing is uploaded.

Loading the tool. It runs entirely in your browser...

How to convert JSON to YAML

Paste JSON into the left box and the YAML appears on the right immediately. JSON is almost a subset of YAML, so the conversion is lossless: every object becomes a mapping, every array becomes a list with dashes, and strings, numbers, booleans and null keep their types.

The converter quotes strings only when it must. A string such as "1.5", "true" or "null" stays quoted because the unquoted form would be read by a YAML parser as a number, a boolean or null. Pick two or four spaces of indentation, and choose whether long strings should wrap at 80 characters or stay on one line.

If the JSON is invalid, you get a line and column error before any YAML is produced. Use the JSON formatter first if you want to repair the source.

Worked example

JSON input:

{"name":"app","version":"1.2.0","ports":[80,443],"env":{"DEBUG":false,"LEVEL":"info"},"owner":null}

YAML output:

name: app
version: 1.2.0
ports:
  - 80
  - 443
env:
  DEBUG: false
  LEVEL: info
owner: null

The version string is shown unquoted here because 1.2.0 cannot be mistaken for a number. A plain 1.2 would be written as "1.2" to preserve its string type.

Things to watch for

  • YAML supports comments, anchors and multiple documents; JSON does not, so those never appear in the output.
  • Key order is preserved from your JSON.
  • Very long single-line strings are folded when wrapping is on. Choose No wrapping if a tool downstream complains.
  • For the reverse direction, including multi-document files, use the YAML to JSON converter.

Frequently asked questions

Is the conversion lossless?

Yes for data. Objects, arrays, strings, numbers, booleans and null map directly to YAML. Only JSON-specific formatting such as whitespace is lost, since YAML has its own layout.

Why are some strings quoted in the output?

Strings that could be misread as another type, such as "true", "null" or "1.5", are quoted so a YAML parser returns the same string you started with.

Which YAML version does the output use?

The output follows YAML 1.2 conventions via the yaml library, the same dialect used by most modern tooling. Kubernetes and Docker Compose read it without changes.

Can I convert large files?

Yes, within your browser memory limits. The conversion is local, so there is no upload delay. Dropping a file onto the input box loads it directly.