Convert YAML to JSON
Paste YAML and get JSON back. Free, no signup, and nothing you paste is stored. The same conversion is available as an API call and to AI agents over MCP.
Input
Result
Fill in the input and press Run.
Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.
How to convert YAML to JSON
- Paste your YAML into the input box.
- Press Run.
- Copy the JSON or download it as a file.
This page runs the yaml to json tool. Open the tool itself for every option.
What happens in this conversion
- What is lost
- Comments are dropped, because JSON has nowhere to put them. Anchors and aliases are expanded into full copies.
- Surprises
- YAML turns unquoted words such as yes, no, on and off into true or false, and version numbers such as 1.10 into numbers. Check the result, and quote those values in the YAML if they should be text.
- One document
- A file holding several documents separated by --- is not accepted. Convert each one separately.
YAML and JSON compared
| Format | What it is | Best for | Watch out for |
|---|---|---|---|
| YAML YAML data | YAML holds the same kind of data as JSON using indentation instead of brackets, and allows comments. Kubernetes, Docker Compose and CI systems use it for configuration. | Configuration files people edit by hand. | Indentation mistakes change the meaning, and unquoted words such as no or on can turn into true or false. |
| JSON JSON data | JSON is the data format of web APIs: nested objects, lists, text, numbers, true, false and null. | Apis and data exchanged between programs. | It has no comments and is tiring to write by hand. |
Use it from code or an agent
curl -s https://setget.net/v1/tools/yaml-to-json \
-H 'Content-Type: application/json' \
-d '{"input":{"text":"name: app\nports:\n - 80\n - 443","indent":0}}'
import json, urllib.request
body = {'input': {'text': 'name: app\nports:\n - 80\n - 443', 'indent': 0}}
request = urllib.request.Request("https://setget.net/v1/tools/yaml-to-json", json.dumps(body).encode(),
{"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/yaml-to-json", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({"input":{"text":"name: app\nports:\n - 80\n - 443","indent":0}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
"slug": "yaml-to-json",
"input": {
"text": "name: app\nports:\n - 80\n - 443",
"indent": 0
}
}
{
"input": {
"text": "name: app\nports:\n - 80\n - 443",
"indent": 0
}
}
Endpoint: POST /v1/tools/yaml-to-json. Over MCP: run_tool with slug: "yaml-to-json".
Machine-readable: input schema, Markdown. Connect an agent.
Inputs
| Name | Type | Required | What it does |
|---|---|---|---|
text |
string | yes | The YAML to convert. |
indent |
integer | no | Spaces per level. 0 gives one compact line. Default: 2. From 0 to 8. |
Questions
- Is my YAML stored anywhere?
- No. It is converted in memory and discarded. It is not saved or logged.
- How much YAML can I convert at once?
- Up to 1 MiB in a single request.
- Can a script or an AI agent convert YAML to JSON?
- Yes. Call POST https://setget.net/v1/tools/yaml-to-json with JSON, or use the run_tool tool of the SetGet MCP server with slug "yaml-to-json". The code samples on this page are ready to copy.
More conversions
Related tools
- JSON to YAMLConvert JSON into clean block-style YAML, keeping key order.
json-to-yaml - YAML validatorCheck whether text is valid YAML and see where the first error is.
yaml-validate - .env to JSONParse a .env file into a JSON object, handling quotes, comments and "export" prefixes.
env-to-json - CSV profilerSummarise each CSV column: type, blanks, distinct values, min, max, mean and top values.
csv-profile - CSV sort, filter and dedupeSort CSV by a column, keep rows containing some text, pick columns and remove duplicate rows.
csv-sort-filter-dedupe - CSV to JSONTurn CSV rows into a JSON array of objects, detecting numbers, booleans and blanks.
csv-to-json