Skip to the JSON editor
JSON Formatter Viewer

JSON to YAML

input.json

output.yaml

The YAML appears here.

or drop a .json file into the left pane

Waiting for input

What the output looks like

YAML is a superset of JSON, so every document converts. Objects become mappings, arrays become block sequences, and scalars keep their type:

{"service": "api", "ports": [80, 443], "env": {"TIER": "prod"}}

service: api
ports:
  - 80
  - 443
env:
  TIER: prod

The three settings that matter

  • No line folding. A long string stays on one line. Folded YAML looks tidier but re-joins with spaces on parse, which quietly corrupts URLs and commands.
  • No anchors. Shared references are duplicated instead of aliased. Anchors are legal but poorly supported downstream, and they make a config harder to read than the repetition they save.
  • JSON-compatible scalars. Ambiguous values are quoted. This is theNorway problem: in YAML 1.1, no parses as false, so an unquoted country code silently becomes a boolean. Quoting removes the trap.

Where this is useful

Most tooling emits JSON while most configuration is written in YAML. Converting is the usual bridge when you are turning an API response into a fixture, moving a package.jsonfragment into a CI pipeline, or writing a Kubernetes manifest from a control-plane response.

Round tripping

YAML to JSON reverses this, and the round trip is lossless for anything JSON can express — comments are the exception, since JSON has nowhere to keep them. To check that a conversion changed nothing, run both versions through theJSON diff.

Common questions

Why are long strings not wrapped?

Line folding is turned off deliberately. Folded YAML re-joins with a space when parsed, which is fine for prose and wrong for a URL, a base64 blob, or a shell command. Leaving long values on one line means what you read is what the parser sees.

What happened to anchors and aliases?

They are disabled. If the same object appears twice in the JSON, it is written out twice rather than becoming &anchor and *alias. Anchors are valid YAML but many consumers — including some Kubernetes tooling — either reject or mishandle them.

Is the YAML safe to paste into a Kubernetes manifest?

Yes. The output is YAML 1.2 in JSON-compatible mode: strings that could be read as numbers, booleans, or dates are quoted, so a version like 1.10 or a value like no does not change meaning when the manifest is applied.

Can I control the indentation?

Use the Indent control in the toolbar. YAML requires spaces — tabs are illegal as indentation in YAML — so choosing Tab falls back to four spaces rather than producing a file no parser will accept.

The rest of the toolkit

Same engine, same privacy — every page runs entirely in your browser.