Paste in JSON or YAML and get instant output in the other format. Runs entirely in your browser. Nothing is uploaded or stored anywhere.
JSON uses curly braces for objects, square brackets for arrays, and double quotes around every key and string value. YAML represents the same structures using indentation for nesting and a colon followed by a space for each key-value pair. JSON has no comment support at all, which makes it awkward for configuration files that need explanation. YAML natively supports hash symbol comments on any line, which is one of the main reasons engineers prefer it for configs. Both formats describe the same underlying data types. Kubernetes manifests, Docker Compose files, and CI/CD pipeline files nearly always use YAML because people write and edit them by hand. REST API payloads and npm package files use JSON because it parses faster and every browser and server runtime supports it natively.
The most common reason to reach for a json to yaml converter is when you have an API response or generated config that you need to turn into a Kubernetes manifest, Ansible playbook, or Helm chart values file. OpenAPI specs are often generated as JSON by tooling but are far easier to read and edit in YAML. GitHub Actions workflow files are YAML, so converting a generated JSON structure is a natural first step when setting up automation. Any time a human will need to read, review, or modify the file regularly, YAML is the more comfortable format to work with.
A yaml to json conversion is most useful when you need to send configuration data to a REST API that expects a JSON body, when preparing state for a frontend application, or when feeding a YAML config into a tool that only accepts JSON. npm package files and most frontend build tool configurations require strict JSON. Anywhere JSON.parse speed matters at runtime, converting YAML to JSON ahead of time is the right call. Debugging is another common case because JSON is much easier to inspect in browser DevTools and most logging platforms display it with syntax highlighting.
Object nesting in JSON requires an opening brace, comma-separated key-value pairs with colons, and a closing brace at every level. YAML expresses the same object as indented lines with no surrounding punctuation. Arrays in JSON use square brackets with comma-separated values. In YAML they are lines prefixed with a hyphen and a space. String escaping works differently too: JSON requires double quotes around all strings and backslash escaping for special characters, while most YAML strings can be unquoted. Comment support is where the formats diverge most sharply. JSON has none. YAML supports a hash symbol comment anywhere on a line. Trailing commas after the last item in a JSON array or object are a syntax error and a common mistake when editing JSON by hand. When converting YAML to JSON, comments are stripped because JSON has no syntax to represent them.
YAML 1.1 parsers treat a set of unquoted words as booleans instead of strings: yes, no, on, off, y, n, true, and false, all case-insensitive. The most famous casualty is the country code NO. Build a list of country codes such as NO, SE, DK, and FI and a YAML 1.1 parser hands your application the boolean false instead of the string "NO" for the first one. Norway becomes false. This passes YAML syntax validation cleanly, because false is a perfectly valid value, so nothing errors. The value is just silently the wrong type, and the bug only surfaces once your code tries to use it as a string.
The same implicit typing reaches version strings and leading zeros too. Write appVersion: 1.10 in a Helm values.yaml file and a YAML 1.1 parser can hand your code the float 1.1, silently dropping the trailing zero that distinguishes version 1.10 from 1.1. Write a port or account number as 0123 and it gets read as octal, becoming 83 in decimal. None of this is consistent across tooling, either: PyYAML defaults to YAML 1.1 behavior, while js-yaml's newer versions default to the stricter YAML 1.2 rules that recognize far fewer implicit booleans. The same file can produce a different value depending on which parser reads it, at different stages of the same pipeline, without the YAML itself ever changing.
The fix is to quote anything that could be misread — "NO", "1.10", "0123" — since YAML never applies implicit typing to a quoted scalar, and to stick to lowercase true and false for real booleans, which both spec versions agree on. This is also where converting through JSON first helps: JSON has no implicit typing at all, a JSON string is always a string, so converting JSON to YAML with the tool above quotes ambiguous-looking values automatically, and "NO" comes out as the string "NO" instead of quietly becoming false. Converting an existing YAML file to JSON works as a check in the other direction, showing you exactly what type each value actually resolved to before it reaches kubectl apply.
The yq tool handles both directions cleanly and fits naturally into automated pipelines and bash scripts. Install it once and use it in any CI workflow that needs format conversion.
# Convert JSON to YAML
yq -Poy input.json > output.yml # Convert YAML to JSON
yq -o json file.yaml > output.json Working with JWT tokens? Try our JWT decoder to inspect token headers, payloads, and expiry times directly in your browser. Need to generate a gitignore file for your project? Use our gitignore generator to create a clean gitignore for any technology stack in one click.