JSON to YAML Converter
Convert JSON to clean YAML format instantly. 100% browser-based with zero data transmission.
About This Tool
Config formats like Kubernetes manifests, Docker Compose, GitHub Actions workflows, and OpenAPI specs are usually authored in YAML, but the data often starts life as JSON from an API response or app config. This tool re-serializes a parsed JSON tree into indented YAML (or back again), preserving nested objects, arrays, and primitive types.
For straight JSON formatting with no format change, use JSON Formatter instead. For the reverse direction without needing to flip this page's dropdown, see YAML to JSON.
Key Features
- Bidirectional conversion: one Direction dropdown (or the ⇌ swap button) switches between JSON → YAML and YAML → JSON.
- 2 or 4-space YAML indent: configurable indentation width for the JSON → YAML direction.
- Smart string quoting: values that could be misread as booleans, numbers, or null (
true,yes, empty strings, etc.) are automatically quoted; plain words are left bare. - Inline empty collections: empty objects and arrays render as
{}and[]rather than empty blocks. - File upload & drag-and-drop: load a
.json,.yaml,.yml, or.txtfile directly. - Keyboard-driven: Cmd/Ctrl+Enter converts, Cmd/Ctrl+Shift+C copies the output.
Example
With 2-space indent:
{
"name": "api-gateway",
"port": 8080,
"tags": ["prod", "v2"]
} produces:
name: api-gateway port: 8080 tags: - prod - v2
FAQ
- Can I convert YAML back to JSON?
- Yes. Switch the Direction dropdown to "YAML → JSON" (or click the swap button between the panes) to parse YAML back into formatted JSON.
- What does the Indent option control?
- It sets the YAML output to 2 or 4 spaces per nesting level. It only applies to the JSON → YAML direction and is hidden when converting the other way.
- When are strings quoted in the output?
- Plain word-like strings are left unquoted. Strings that look like reserved YAML words (
true,false,null,yes,no,on,off), numbers, empty strings, or contain special characters are wrapped in quotes so they don't get misread as a different type. - How are empty objects and arrays handled?
- An empty JSON object becomes
{}and an empty array becomes[]inline, instead of an empty block. - Can I upload a file?
- Yes. Use the Upload button or drag a
.json,.yaml,.yml, or.txtfile onto the input panel. Conversion is 100% browser-based with zero data transmission.