How the JSON to YAML converter works
The converter reads your JSON with the browser's own JSON.parse, then writes it as block-style YAML with js-yaml 4.1.1. It converts as you type. Choose 2 or 4 spaces of indentation, then copy the result or download it as a .yaml file.
Objects become indented key-value mappings and arrays become lists that start with a dash, so {"app":{"name":"web","ports":[80,443]}} becomes app: ⏎ name: web ⏎ ports: ⏎ - 80 ⏎ - 443. Long lines are never wrapped, and repeated values are written out in full rather than as anchors, so the output is easy to read and diff.
Because everything happens in your browser, you can safely paste API responses, Terraform or CloudFormation output, or app settings that contain internal hostnames. Nothing is sent to a server.
Why some strings are quoted
YAML has fewer quotes than JSON, so a plain word can be read as something else. Older YAML 1.1 parsers, such as Python's PyYAML, turn yes, no and on into booleans and 012 into an octal number. To keep your data exactly the same in every parser, strings that could be misread are quoted: {"answer":"yes","country":"NO","zip":"012","version":"3.10","n":12} becomes answer: 'yes' ⏎ country: 'NO' ⏎ zip: '012' ⏎ version: '3.10' ⏎ 'n': 12.
Real numbers, true, false and null are written without quotes, because they mean the same thing in JSON and YAML. Strings with line breaks become readable block scalars: {"motd":"Line one\nLine two\n"} becomes motd: | ⏎ Line one ⏎ Line two.
Fixing invalid JSON
If the JSON cannot be parsed, you get the line and column of the problem (counted from 1) and the surrounding lines with a marker. For example, a missing colon gives “Line 2, column 6: Unexpected number in JSON at position 14”. Click Go to line to jump there.
The usual causes are a trailing comma after the last item, single quotes instead of double quotes, keys without quotes, and comments, none of which are allowed in strict JSON.
Tips for clean YAML
Use 2 spaces unless your project says otherwise. It is the most common style for Kubernetes, Docker Compose and GitHub Actions files.
Add comments afterwards. JSON has no comments, so the YAML starts without any. Adding a few short comments is one of the main reasons to switch a config to YAML.
Check the round trip. Switch the direction to YAML → JSON and your YAML is moved into the input, so you can confirm it converts back to the same data. You can also use our dedicated YAML to JSON converter, or search the output with the regex tester.