📥

YAML to JSON

POST /v1/convert/yaml-to-json
curl -X POST "https://convert.toolkitapi.io/v1/convert/yaml-to-json" \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"yaml": "app: myservice\nreplicas: 3\nports:\n  - 80\n  - 443"}'
# See curl example
// See curl example
Response 200 OK
{
  "json": {
    "app": "myservice",
    "replicas": 3,
    "ports": [80, 443]
  },
  "size": 52
}

How to Use

1

Send a POST request to /v1/convert/yaml-to-json with a yaml string.

About This Tool

Parse YAML into a JSON object using Python's safe_load for security. Supports all standard YAML constructs: mappings, sequences, scalars, multi-line strings, and anchors.

Only safe YAML types are accepted — no arbitrary Python objects or custom tags. This prevents code execution via malicious YAML.

Why Use This Tool

Frequently Asked Questions

Is it safe to parse untrusted YAML?
Yes — we use safe_load which only accepts standard YAML types (strings, numbers, booleans, lists, dicts). No arbitrary object instantiation.
Are YAML anchors supported?
Yes — anchors and aliases are resolved during parsing and the final JSON contains the expanded values.

Start using YAML to JSON now

Get your free API key and make your first request in under a minute.