How to convert JSON to YAML online
jsonsql.dev converts JSON to YAML instantly in your browser — with bidirectional conversion, block scalar multiline strings, and configurable 2-space or 4-space indentation. No data is sent to any server; everything runs client-side in JavaScript, so your Kubernetes configs, Docker Compose files, and API payloads never leave your machine.
Paste your JSON or YAML — copy your data from an API response, config file, or code and paste it into the input editor on the left.
Choose direction — select JSON → YAML or YAML → JSON using the tabs above the editor. The conversion happens automatically.
Copy the result — click Copy to copy the converted output to your clipboard.
Example
JSON input:
{
"name": "Alice",
"age": 30,
"active": true,
"skills": ["JavaScript", "Python", "Go"],
"address": {
"city": "San Francisco",
"state": "CA"
},
"bio": "Software engineer.\nLoves open source."
}
YAML output:
name: Alice
age: 30
active: true
skills:
- JavaScript
- Python
- Go
address:
city: San Francisco
state: CA
bio: |
Software engineer.
Loves open source.
Features
- Convert JSON to YAML with proper indentation and block scalars
- Convert YAML back to JSON with correct types (strings, numbers, booleans, null)
- Toggle between JSON → YAML and YAML → JSON modes
- Choose 2-space or 4-space indentation
- Handles nested objects, arrays, and multiline strings
- Special YAML characters are automatically quoted
- Real-time conversion as you type
- Dark and light theme support
- 100% client-side — no data is sent to any server
- Works offline after the page loads
JSON vs YAML comparison
| Feature | JSON | YAML |
|---|---|---|
| Readability | Good with formatting | Excellent — minimal syntax |
| Comments | Not supported | Supported (#) |
| Multiline strings | Escaped \n only | Block scalars (| and >) |
| Data types | String, number, boolean, null, object, array | Same + dates, timestamps |
| Use cases | APIs, data exchange, configs | Configs (Docker, K8s, CI/CD) |
| File size | Larger (braces, quotes) | Smaller (indentation-based) |
| Parsing speed | Faster (simpler grammar) | Slower (complex grammar) |
| Strict syntax | Yes — no trailing commas | Indentation-sensitive |
JSON to YAML vs other tools
| Feature | jsonsql.dev | transform.tools | yq (CLI) |
|---|---|---|---|
| Browser-based | Yes | Yes | No (CLI) |
| Client-side only | Yes | No (server) | Yes (local) |
| Bidirectional | Yes | Separate pages | Yes |
| Indent options | 2 / 4 spaces | Limited | Yes |
| Multiline strings | Block scalars | Varies | Yes |
| Dark mode | Yes | No | N/A |
| Works offline | Yes | No | Yes |
| No install needed | Yes | Yes | No |
Related tools
Frequently asked questions
How do I convert YAML to JSON?
Switch to "YAML → JSON" mode using the tab at the top, paste your YAML, and the JSON output is generated automatically.
What YAML features are supported?
The converter handles objects (mappings), arrays (sequences), strings, numbers, booleans, null values, nested structures, and multiline strings using YAML block scalars (|).
Does it handle multiline strings?
Yes. Strings containing newlines are converted to YAML block scalar syntax (|), which preserves line breaks without escape characters.
Can I use this for Kubernetes or Docker Compose files?
Yes. You can paste JSON and convert it to YAML for use in Kubernetes manifests, Docker Compose files, GitHub Actions workflows, or any YAML-based configuration.
What is the difference between JSON and YAML?
JSON uses braces, brackets, and quotes for structure. YAML uses indentation and minimal syntax. YAML supports comments and multiline strings natively, while JSON does not. Both represent the same data structures.
What happens with special characters in YAML?
Strings containing special YAML characters (like colons, hashes, brackets, or leading/trailing spaces) are automatically quoted to ensure valid YAML output.
Can I add comments when converting JSON to YAML?
JSON does not support comments, so the converter cannot generate YAML comments from JSON data. However, once you copy the YAML output, you can freely add comments using the # syntax. If you convert YAML with comments back to JSON, the comments are discarded since JSON has no comment syntax.
Does the converter support YAML anchors and aliases?
No. YAML anchors (&anchor) and aliases (*anchor) are a YAML-specific feature for reusing nodes. Since JSON has no equivalent concept, the converter does not generate or parse anchors. If your YAML input uses aliases, expand them manually before converting to JSON.
How do I convert a large JSON file to YAML without crashing?
This tool runs entirely in your browser, so performance depends on your device memory. Files up to 5-10 MB typically convert in under 1 second. For files larger than 50 MB, consider splitting the JSON into smaller chunks or using a CLI tool like yq.
What is the difference between YAML block scalar (|) and flow scalar (>) for multiline strings?
The literal block scalar (|) preserves every newline exactly as-is, which is what this converter uses. The folded block scalar (>) joins lines with spaces, treating it like a paragraph. For JSON-to-YAML conversion, literal style (|) is preferred because it produces output identical to the original JSON string when converted back.