Paste a valid JSON document into the input, select two space indentation, and convert it to YAML. Compare the objects, arrays, and nested values with the examples below before copying or downloading the result. A JSON object maps to a YAML mapping, and an array maps to a sequence. Check scalar types when the destination configuration distinguishes numbers, strings, and null.
Keep the original JSON if another program still consumes it. JSON does not support comments; comments added to YAML are lost if you convert that data back to JSON. Multiline YAML strings can preserve or fold line breaks, so inspect their parsed values rather than their visual layout alone. Use the command line examples only with the required Python YAML package installed.
{
"database": {
"host": "localhost",
"port": 5432,
"name": "myapp"
}
}
database:
host: localhost
port: 5432
name: myapp
{
"servers": ["web1", "web2", "web3"]
}
servers:
- web1
- web2
- web3
{
"services": [
{
"name": "api",
"ports": [8080, 8443],
"env": {"NODE_ENV": "production"}
}
]
}
services:
- name: api
ports:
- 8080
- 8443
env:
NODE_ENV: production
# This comment will be lost in JSON
database:
host: localhost # Also lost
description: |
This is a multi-line
string that preserves
line breaks.
{
"description": "This is a multi-line\nstring that preserves\nline breaks.\n"
}
value: null # Explicit
value: ~ # YAML shorthand
value: # Empty value = null
{ "value": null }
# JSON to YAML
python3 -c "import json, yaml, sys; print(yaml.dump(json.load(sys.stdin), default_flow_style=False))" < input.json > output.yaml
# YAML to JSON
python3 -c "import json, yaml, sys; print(json.dumps(yaml.safe_load(sys.stdin), indent=2))" < input.yaml > output.json
YAML is more human-readable than JSON for configuration files, especially those with deeply nested structures. Many tools like Docker Compose, Kubernetes, Ansible, and GitHub Actions use YAML for their configuration files.
Yes. Numbers, booleans, strings, arrays, and nested objects are all properly converted. YAML natively supports the same data types as JSON, so no information is lost during conversion.
Processing runs in your browser. Choosing Share uploads the selected tool state; anyone with the link can open it. Signing in to save sends content to your account library and records save history. Review the selection before either action. Closing the page does not delete those copies. Copying locally does not create a server share.
The file upload accepts .json or .txt files up to 100 MiB. Processing time depends on device memory, input structure, and output size. Running locally avoids a processing upload, but does not guarantee millisecond execution. Start with a representative sample and inspect the converted values before processing a large configuration.
You can customize indentation size (2, 4, or 8 spaces) and toggle flow style for compact inline formatting of arrays and objects.