JSON to YAML Converter — Free Online Tool
Convert JSON to YAML format online. Produces clean, readable YAML from any JSON object. Free, browser-based.
YAML is more human-readable than JSON — it uses indentation instead of brackets, does not require quotes for most strings, and supports comments. This tool converts any valid JSON to idiomatic YAML using the js-yaml library. The output uses 2-space indentation, avoids unnecessary quoting, and produces clean YAML ready to use as a configuration file. Arrays are rendered using the YAML block sequence style for readability.
How to use
- Paste your JSON object or array into the input textarea.
- Click 'Convert to YAML' to generate the YAML output.
- Copy the YAML to clipboard or download it as a .yaml file.
FAQ
How are JSON types mapped to YAML types?
JSON strings become YAML strings (quoted only when necessary for disambiguation — e.g., the string 'true' is quoted as 'true' to prevent it being interpreted as a YAML boolean). JSON numbers become unquoted YAML integers or floats. JSON true/false become YAML true/false. JSON null becomes YAML null. JSON arrays become YAML block sequences. JSON objects become YAML block mappings.
Are string values always quoted in the YAML output?
No. js-yaml only quotes strings when quoting is required to avoid ambiguity. Simple strings containing only alphanumeric characters, hyphens, underscores, and spaces are not quoted. Strings that could be misinterpreted as other types (e.g., 'true', 'null', '1.5', '2024-01-01') are automatically quoted to preserve their string type.
Does the YAML output support comments?
No. JSON does not have comments, so there is no information to convert into YAML comments. The output YAML contains only the data from the JSON input, with no comments. You can manually add comments to the YAML output after downloading it.
What indentation level is used in the YAML output?
The output uses 2-space indentation, which is the most common convention for YAML configuration files. This is consistent with Kubernetes manifests, Docker Compose files, GitHub Actions workflows, and most other YAML-based configuration systems.
Can I use this to create Kubernetes manifests from JSON?
Yes, to a degree. Kubernetes API responses are JSON (when queried with kubectl get -o json). You can convert these to YAML format for storage in version control. However, the converter produces semantically equivalent YAML, not necessarily the minimal manifest format used when writing Kubernetes configs by hand. You may want to remove fields like status and resourceVersion from the JSON before converting.
Is the conversion done in my browser or on a server?
The conversion runs entirely in your browser using the js-yaml library. No data is sent to any server, which is important for JSON content that may contain API keys, tokens, or other sensitive configuration data.