YAML ↔ JSON
Convert YAML to JSON and JSON to YAML in either direction.
YAML ↔ JSON Converter
Convert configuration files between YAML and JSON formats. Conversion runs as you type.
What YAML ↔ JSON does
YAML and JSON describe the same kinds of data, and configuration frequently has to move between them: a Kubernetes manifest into a JSON API call, or an API response into a readable config file.
The conversion parses the source into a data structure and re-serialises it in the target format, so the result reflects the data rather than the original text layout. Comments, which YAML has and JSON does not, are lost in that step.
- Convert YAML to JSON with two-space indentation
- Convert JSON to YAML
- Report the parser's real error when the source will not parse
- Swap direction without re-pasting
How to use YAML ↔ JSON
- 1
Choose the direction
Switch between YAML to JSON and JSON to YAML. Switching also moves the current result into the input so you can convert back.
- 2
Paste the source
Paste a complete document rather than a fragment.
- 3
Read the output
The converted document appears alongside. Parse errors are shown with the message from the parser.
- 4
Copy the result
Copy the converted document into your file or request.
Limits and known behaviour
- YAML comments are discarded. JSON has no way to represent them, so converting a commented config to JSON and back loses every comment permanently.
- Multi-document YAML files separated by --- are not supported; convert one document at a time.
- YAML anchors and aliases are resolved during parsing, so repeated structures are expanded rather than preserved as references.
- YAML's implicit typing can surprise you: unquoted yes, no, on and off are booleans in some YAML versions, and a value such as 09 may not be the string you expected. Quote values you want treated as text.
- Long strings may be wrapped when written as YAML.
Privacy and data handling
Runs entirely in your browser
- Your input is processed by JavaScript running in this page. The tool sends no request anywhere, so nothing you paste is transmitted or logged by this site.
- Nothing is saved between visits. Closing or reloading the tab discards whatever is in the fields.
Site-wide data handling, including analytics and advertising, is described in the privacy policy.
Frequently asked questions
Where did my comments go?
JSON has no comment syntax, so they cannot survive the conversion. If you need the commented version, keep the YAML file as the source of truth and treat the JSON as generated output.
Why did my version number become a number?
YAML infers types from unquoted values, so 1.10 is read as the number 1.1 and loses the trailing zero. Quote version strings to keep them as text.
Does it validate against a schema?
No. It checks that the document parses, not that it matches any particular schema.