Convert JSON to YAML Online
Paste data written with braces and brackets and get the same content as indented YAML: a service with ports 8080 and 8443 becomes a readable list, and true, false and empty values keep their meaning. Broken input is rejected, never half converted. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Objects become YAML mappings, arrays become sequences, and strings, numbers, booleans, and null values retain their meaning. Output is deterministic and ready to copy into configuration files, documentation, deployment workflows, or version-controlled projects.
Two ways of writing the same data
Apps, services and exports usually produce data with braces, brackets, commas and quotes, while YAML expresses the same content with indentation. Both can describe the same basic data, but YAML is easier for people to read and review, which is why it is so common in configuration files and documentation. Converting by hand means removing every brace and comma and getting each indentation right, which is slow and easy to get wrong in a long file. Here each group of named values becomes a YAML mapping, each list becomes a sequence, and nested structures, such as groups inside lists, are indented consistently.
Why some values are quoted on purpose
YAML guesses the type of a value from how it looks, and that guess can quietly change your data. A text value such as true, null, a date or an identifier made only of digits could be read back as a yes-or-no value, an empty value, a date or a number. To prevent that, keys and text values are quoted deliberately, so they stay text. The document is also checked in full before anything is written, and the same input always gives the same output, ready for a project kept under version control or a deployment workflow.
FAQ
Why are keys and text values wrapped in quotes?
So that values such as true, null, dates or numbers used as identifiers stay text and are not reinterpreted when the YAML is read back. The quotes keep the meaning of your data exactly as it was.
What happens if my input has a syntax mistake?
Nothing is converted. The whole document is checked before any YAML is written, so input with a missing comma or bracket is rejected instead of producing a partial result that looks plausible but cannot be trusted.
Are empty groups and empty lists kept in the YAML?
Yes. Empty groups of values and empty lists are written out explicitly, so the structure you had before the conversion is still visible afterwards and nothing silently disappears from the file.
Do numbers, true, false and empty values keep their type?
Yes. Text stays text, numbers stay numbers, true and false stay yes-or-no values and empty values stay empty. In the example, the ports 8080 and 8443 remain numbers and the empty notes stay empty.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/web/json-to-yaml \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"{\"service\":{\"name\":\"api\",\"enabled\":true,\"ports\":[8080,8443]},\"replicas\":3}"}'const res = await fetch("https://api.kit.forhosting.com/web/json-to-yaml", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "{\"service\":{\"name\":\"api\",\"enabled\":true,\"ports\":[8080,8443]},\"replicas\":3}"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/web/json-to-yaml",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "{\"service\":{\"name\":\"api\",\"enabled\":true,\"ports\":[8080,8443]},\"replicas\":3}"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/web/json-to-yaml", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"{\\"service\\":{\\"name\\":\\"api\\",\\"enabled\\":true,\\"ports\\":[8080,8443]},\\"replicas\\":3}"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"{\"service\":{\"name\":\"api\",\"enabled\":true,\"ports\":[8080,8443]},\"replicas\":3}"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/web/json-to-yaml", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"text": "{\"service\":{\"name\":\"api\",\"enabled\":true,\"ports\":[8080,8443]},\"replicas\":3}"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "web.json_to_yaml",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
timeout_sec | 30 |
max_crawl_pages | 25 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Convert a JSON string into equivalent YAML without manually replacing braces, commas, quotes, and array syntax. The converter parses the complete JSON document first, so malformed input is rejected instead of producing a plausible but unreliable partial result. Use the browser for quick conversions or call the API when JSON-to-YAML transformation belongs in an automated process.
Convert structured data without changing its meaning
Nested structures are indented consistently, including objects inside arrays and arrays inside objects. Strings and mapping keys are quoted deliberately so values such as "true", "null", dates, numeric-looking identifiers, and punctuation remain strings rather than being reinterpreted by a YAML parser. Empty objects and empty arrays are preserved explicitly. JSON and YAML can represent the same basic data model, but they optimize for different situations. JSON is widely produced by APIs and software, while YAML is often easier for people to review in configuration files and documentation. This converter bridges those formats by parsing the JSON before writing any YAML. Each JSON object becomes a YAML mapping, each array becomes a sequence, and primitive values remain strings, numbers, booleans, or null values as appropriate. Because the algorithm has no network calls, randomness, clock access, or model inference, identical JSON produces identical YAML.
Prepare valid JSON and understand the output
If any of those appear, parsing fails and the capability returns an invalid-input error containing the parser’s explanation. No YAML is emitted from malformed input, which prevents a broken source document from becoming a misleading configuration. The generated YAML uses a two-space indentation level and block-style collections for non-empty objects and arrays. Unicode text, escaped quotation marks, line breaks, and backslashes remain encoded safely. Supply one complete JSON value as text. The root may be an object, array, string, number, boolean, or null, although objects and arrays are the most common inputs for configuration work. JSON requires double-quoted property names and string values, commas between members, and matching braces or brackets. It does not allow comments, trailing commas, single-quoted strings, unquoted keys, undefined values, NaN, or Infinity. Keys and string values use JSON-compatible double-quoted syntax, which YAML also accepts. This conservative representation favors faithful types over decorative minimalism. Remember that JSON itself cannot preserve comments or formatting choices from its source, so the output represents the parsed data rather than the original spacing.
Use interactive conversion or automate repeatable workflows
A migration utility can translate exported settings while retaining arrays, empty collections, and scalar types. The capability only performs syntax conversion; it does not know whether the resulting keys are accepted by Kubernetes, Docker Compose, a CI provider, or another consumer. The browser tool is useful when an API response needs to become a readable example, when a JSON settings file must be adapted for a YAML-based application, or when you want to inspect deeply nested data in a more vertical layout. Paste the JSON, run the conversion, and copy the returned YAML into the destination after checking any application-specific schema requirements. For repeated work, call the API for $0.002 per item and treat invalid input as a terminal validation failure rather than retrying the same text. A build script can convert generated JSON into a YAML artifact before packaging. Validate the YAML against that destination’s schema afterward. Since conversion is deterministic, automation can compare generated files reliably and commit changes only when the underlying JSON data actually changes.
Integration use cases
Create a YAML configuration
Turn application settings exported as JSON into a readable YAML document while preserving nested objects, arrays, and scalar types.
Publish API examples
Generate a YAML version of a tested JSON response or request fixture for documentation without maintaining two independent data copies.
Automate format migration
Convert machine-generated JSON artifacts into deterministic YAML before validation, packaging, review, or delivery to another tool.
Technical questions
How much does JSON-to-YAML conversion cost?
Each API conversion costs $0.002 per item. The browser tool is available for interactive conversion.
What happens if the JSON is invalid?
The capability returns an invalid_input error with the parser message and does not emit partial YAML.
Are strings, numbers, booleans, and null preserved?
Yes. Strings are quoted to protect their type, while JSON numbers, booleans, and null are emitted as their corresponding YAML scalars.
Can the root JSON value be an array or primitive?
Yes. Any complete valid JSON value can be converted, including an object, array, string, number, boolean, or null.
Does the converter validate an application-specific YAML schema?
No. It produces syntactically valid YAML equivalent to the JSON data; validate the result separately against the destination application's schema.