YAML to JSON
Parse YAML into JSON.
POST
1 credit
/v1/convert/yaml-to-json
curl -X POST "https://convert.toolkitapi.io/v1/convert/yaml-to-json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"yaml": "name: example\nversion: 1.0.0\ntags:\n- cli\n- api"}'
import httpx
resp = httpx.post(
"https://convert.toolkitapi.io/v1/convert/yaml-to-json",
json={"yaml": "name: example\nversion: 1.0.0\ntags:\n- cli\n- api"},
)
print(resp.json())
const resp = await fetch("https://convert.toolkitapi.io/v1/convert/yaml-to-json", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({"yaml": "name: example\nversion: 1.0.0\ntags:\n- cli\n- api"}),
});
const data = await resp.json();
console.log(data);
# See curl example
Response
200 OK
{
"json": {"name": "example", "version": "1.0.0", "tags": ["cli", "api"]}
}
Description
Parse YAML into JSON.
How to Use
1
1. POST a JSON body with `yaml` (or `url`).
2
2. Optionally set `document_index` to pick a document in a multi-doc stream.
3
3. Read the parsed `json` from the response.
About This Tool
Parses YAML into JSON. Supports single-document and multi-document streams (selectable via `document_index`).
All YAML scalars are resolved to JSON types: ints, floats, booleans, nulls, and strings. Anchors and aliases are expanded inline.
Why Use This Tool
- CI pipelines — Parse GitHub Actions / GitLab CI YAML programmatically
- Kubernetes manifests — Load YAML manifests into JSON-native tools
- Config normalization — Convert YAML configs to JSON for APIs that prefer JSON
- Validation — Run JSON-schema validation against YAML sources
Frequently Asked Questions
Multi-document YAML?
Separate documents with `---`. Use `document_index` to select which one to parse.
Are anchors and aliases supported?
Yes — references are expanded inline.
What about dates?
YAML date/time tags are emitted as ISO-8601 strings in JSON.
Start using YAML to JSON now
Get your free API key and make your first request in under a minute.