Convert YAML to JSON Online
Paste a YAML configuration and get the same data as structured objects and lists: in the example, ports 8080 and 8443 arrive as real numbers and true and false stay yes-or-no values. Broken indentation is reported, never guessed. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Convert structured configuration without changing its meaning
YAML is popular for configuration because indentation and concise list syntax make large documents comfortable for people to edit. Nested services, environment settings, port lists, feature flags, and metadata therefore remain structured rather than being flattened into text. The conversion is deterministic, so identical input always produces the same object and key order.
That stability is useful when generated output is reviewed in a pull request or compared by a test. If the source contains malformed indentation, an unclosed flow collection, a broken quoted value, or another syntax problem, the operation fails clearly instead of silently inventing a structure that might be deployed.
Prepare YAML carefully and understand the resulting types
Start with one YAML document containing a mapping, a sequence, or nested combinations of both. Indentation must use spaces rather than tabs, and sibling entries must align at the same level. Both block collections and familiar flow forms such as [one, two] and {name: api, enabled: true} are accepted.
Literal and folded block text can represent multiline content, while inline comments are ignored during data conversion. When a file contains document separators for several independent documents, split it first and convert each document separately.
For a quick look or a repeatable build
Paste the source, run the converter, and copy the structured result into the destination tool. A support tool can expose parsed configuration to a safe object inspector without maintaining a second conversion implementation. In every case, treat an invalid-input response as a signal to stop the pipeline and return the parser message to the person who owns the source.
Do not retry unchanged invalid YAML because parsing is deterministic. Since the algorithm uses no network, clock, random value, or model, it is appropriate for repeatable builds and tests where the same source must always lead to the same result.
FAQ
Does it preserve numbers and booleans?
Quote a value in YAML when it must remain a string.
Why does my YAML fail to convert?
Usually because of tabs instead of spaces in the indentation, sibling entries that do not line up, an unclosed bracket or brace, or a broken quoted value. The message points to the problem, and retrying unchanged gives the same error because parsing never varies.
How do I keep a number-like code or the word true as text?
Put it in quotes. Unquoted, true and false become yes-or-no values and digits become numbers. In quotes, an identifier that only looks numeric, or the word true itself, stays exactly as written text.
What happens to comments in my YAML?
They are ignored during conversion. The target format has no standard place for comments, so they do not appear in the result, but they never change the data around them either.
Are anchors or several documents in one file supported?
No. Anchors, references to them and explicit tags are refused rather than resolved incorrectly, and each conversion takes a single document. If a file holds several, split it at the document separators and convert each part on its own.
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/yaml-to-json \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"service:\n name: api\n ports:\n - 8080\n - 8443\nenabled: true"}'const res = await fetch("https://api.kit.forhosting.com/web/yaml-to-json", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "service:\n name: api\n ports:\n - 8080\n - 8443\nenabled: true"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/web/yaml-to-json",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "service:\n name: api\n ports:\n - 8080\n - 8443\nenabled: true"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/web/yaml-to-json", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"service:\\n name: api\\n ports:\\n - 8080\\n - 8443\\nenabled: true"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"service:\n name: api\n ports:\n - 8080\n - 8443\nenabled: true"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/web/yaml-to-json", 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:\n name: api\n ports:\n - 8080\n - 8443\nenabled: true"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "web.yaml_to_json",
"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 YAML document into equivalent JSON without manually rewriting indentation, lists, booleans, numbers, or nested configuration objects. Paste YAML into the browser tool for an immediate result, or call the API when conversion belongs in a build, validation, migration, or deployment workflow. The parser produces deterministic JSON-compatible data and reports invalid YAML as an input error instead of returning a guessed or partially converted document. That makes the result suitable for both quick inspection and repeatable automation.
Convert structured configuration without changing its meaning
Many APIs, browser tools, validators, and programming environments expect JSON instead. This converter bridges those formats while preserving the underlying data model: mappings become JSON objects, sequences become arrays, and recognized booleans, numbers, strings, and null values retain their appropriate types. Comments are not represented in the JSON result because JSON has no standard comment type, but a comment does not alter the parsed data.
Prepare YAML carefully and understand the resulting types
Plain values such as true, false, null, integers, decimals, and scientific notation are converted to their matching JSON types. Quote a value when it must remain text, especially when a numeric-looking identifier or a word such as true should not become a number or boolean. The capability deliberately rejects YAML anchors, aliases, and explicit tags rather than pretending to resolve advanced features incorrectly. It also accepts only one YAML document per request. These boundaries keep failures understandable and make every returned value directly serializable as standard JSON.
Use browser conversion for inspection and the API for automation
The browser experience is convenient when reviewing a configuration file, preparing an API request, debugging a deployment manifest, or showing a teammate exactly how a YAML hierarchy maps into JSON. For repeated work, send the same text field through the API for $0.002 per item. A continuous integration job can convert a checked-in configuration before passing it to a JSON Schema validator. A migration script can normalize incoming YAML before storing data in a JSON-oriented system.
Integration use cases
Validate deployment configuration
Convert a YAML service or deployment file to JSON before applying a JSON Schema validator in continuous integration.
Prepare data for a JSON-only API
Turn a human-maintained YAML request template into the JSON object required by an integration or internal service.
Inspect nested settings
Convert unfamiliar YAML into JSON so a browser inspector, diff tool, or debugging utility can display its exact structure and types.
Technical questions
How much does YAML to JSON conversion cost?
Each API conversion costs $0.002 per item. The browser tool can be used directly for interactive conversion.
What happens when the YAML syntax is invalid?
The capability returns an invalid_input error with a message describing the detected syntax or indentation problem; it does not return partial JSON.
Are YAML comments included in JSON?
No. JSON has no standard representation for YAML comments, so comments are ignored while the underlying data values are preserved.
Can it convert several YAML documents in one request?
No. Submit one YAML document per request so the result is one unambiguous JSON value.