Code Beautifier

JSON to YAML

Convert JSON into clean, correctly quoted YAML for Kubernetes manifests, Docker Compose files, and CI configs.

Draft saved locally.

Local workspace

Named projects in IndexedDB · Local only — never synced to our servers. Worksp

Open manager

Batch workspace

Format multiple files locally in one run.

Indent:
json
Formatted Outputyaml

JSON to YAML conversion looks trivial until a config breaks in production. YAML 1.1 parsers, still used by PyYAML and many deployment tools, turn the country code NO into false, a port mapping like 22:22 into 1342, and a file mode like 0644 into 420. This converter keeps those values as strings by quoting exactly the ones that are ambiguous, preserves key order so diffs stay small, and can split a JSON array into separate YAML documents for kubectl. Errors in the JSON input report the line and column, and the YAML Validator checks the result under both YAML versions.

Common errors and fixes

Expected double-quoted property name in JSON

Remove the trailing comma before a closing brace, or put double quotes around the key.

Expected ',' or '}' after property value in JSON

Add the missing comma between two properties. The error points at the start of the second one.

Unexpected non-whitespace character after JSON

Two JSON documents were pasted back to back. Wrap them in [ ] and turn on 'Array → separate documents'.

A value changed type after conversion

Unquoted 22:22, yes, no, on, or 0123 are retyped by YAML 1.1 parsers. Keep the quotes this converter adds instead of removing them by hand.

Options

OptionDescription
IndentSpaces per nesting level in the YAML output.
Sort keysWrites mapping keys in alphabetical order for stable diffs. Off keeps the key order from the JSON.
Array → separate documentsWhen the JSON is an array, writes each item as its own YAML document separated by ---, the layout kubectl apply expects for several resources.

FAQ

Why are values like 22:22, NO, and 0123 quoted in the YAML?

YAML 1.1 parsers such as PyYAML read an unquoted 22:22 as the base-60 number 1342, NO and on as booleans, and 0123 as the octal number 83. The converter quotes those strings so every parser keeps them as text.

Can I turn a JSON array into multiple YAML documents?

Yes. Turn on 'Array → separate documents' and each item is written as its own document, separated by ---. That's the layout kubectl apply -f expects for several resources in one file.

Will converting to YAML change my data?

No. Values and key order are preserved unless you turn on Sort keys, and the YAML parses back to the same JSON. JSON has no comments, so the YAML won't have any either.

Is the output ready for Kubernetes and Docker Compose?

It's standard block-style YAML, which both accept. The converter checks syntax only, so use the Kubernetes Manifest tool to catch missing fields such as metadata.name.

How do I convert YAML back to JSON?

Use the YAML to JSON converter, or press Swap after converting to send the YAML output there.