Convert JSON to YAML

Turn a JSON object or array into YAML suitable for a config file, a Kubernetes manifest or a CI pipeline. Indentation is configurable, keys can be sorted, and strings that YAML would otherwise read as booleans or numbers are quoted automatically so they keep their type.

✓ Runs in your browser — nothing uploaded Free, no sign-upNo watermark

Off repeats the content instead, which is easier to read.

How to use the JSON to YAML

  1. Paste valid JSON; a syntax error is reported with its line and column.
  2. Choose the indent your project uses — two spaces is the near-universal convention.
  3. Optionally sort keys or add a --- document marker.
  4. Copy the YAML into your config file.

Why YAML for configuration

YAML says the same things as JSON with a fraction of the punctuation, and it allows comments, which is usually the deciding factor for a file humans edit. Kubernetes, GitHub Actions, GitLab CI, Docker Compose, Ansible and OpenAPI all take YAML, so converting a JSON sample from documentation into the form your repository expects is an everyday task.

Indentation rules

Two spaces per level is the convention almost everywhere; the option goes up to eight for house styles that differ. One rule is absolute: YAML forbids tab characters for indentation, and this tool never emits them. If you paste the output into an editor that converts leading spaces to tabs, the file will stop parsing.

The quoting traps

YAML infers types from unquoted scalars, and several look like text but are not.

Unquoted valueRead asWrite instead
yes, no, on, offBoolean in YAML 1.1 tools"yes"
null, ~, emptyNull"null"
1.20The number 1.2"1.20"
007Number 7 (or octal in old parsers)"007"
2026-09-23A date, not a string"2026-09-23"

Because the input is JSON, the type of every value is already known, so the converter quotes exactly those strings that would otherwise change meaning and leaves the rest bare. Turn on "quote every string" if a downstream tool is strict or you would rather not think about it.

Anchors

When the same object appears more than once, YAML can define it once with an anchor (&name) and refer to it afterwards (*name). That keeps large manifests DRY but makes them harder to read and to diff, so this tool repeats the content by default and only emits anchors if you ask for them.

Long strings and line width

By default lines are never wrapped, which keeps URLs, base64 blobs and long commands on a single line where they can be copied intact. The 80-column option folds long scalars for readability — safe for prose, but check any value where whitespace is significant before using it.

Key order

YAML mappings are unordered, like JSON objects, but the file is read by humans, so order matters in practice. Conversion preserves the order of the JSON input; sorting alphabetically is useful when you want two generated files to diff cleanly.

Frequently asked questions

Does the output use tabs?

Never. YAML forbids tabs for indentation, so only spaces are emitted — one to eight per level, your choice.

Why are some strings quoted and others not?

Values such as yes, no, null, 007 and 1.20 would change type if left bare, so they are quoted. Everything else stays unquoted for readability.

Can I add comments?

Not automatically — JSON has none to carry over. Add them by hand after converting; they are one of the main reasons to use YAML.

Will the output work as a Kubernetes manifest?

Yes, provided the JSON already has the right fields. Turn on the --- marker if you are concatenating several manifests into one file.

Privacy

This tool runs entirely inside your browser using WebAssembly and the Canvas/File APIs. Your files are never uploaded to ToolFlint or any third party; you can verify this in your browser's network tab or by switching to airplane mode after the page loads. Read how we process files.

Last updated 2026-09-23.