YAML → JSON
Try it interactively →POST /api/yaml-to-jsonParse YAML 1.2 into JSON. Handles anchors, aliases, multi-document streams, and the explicit-tag forms.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| yaml* | file | — | The YAML document. |
| indent | number (0…8) | 2 | JSON indent width. 0 = compact one-line output. |
Response
Modes: json, text. Cache: yes (24h TTL).
Code samples
Built from the config example.
# Download or substitute the example input:
# curl -O https://xtract.bot/examples/yaml-to-json/config.yaml
YAML=$(base64 -w0 < config.yaml)
curl -X POST https://api.xtract.bot/api/yaml-to-json \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
-H "X-Api-Key: $XTRACT_API_KEY" \
-d '{
"indent": 2,
"yaml": "'"$YAML"'"
}'