xtract.bot
POST /api/yaml-to-json

Parse YAML 1.2 into JSON. Handles anchors, aliases, multi-document streams, and the explicit-tag forms.

Parses a YAML 1.2 document and emits the equivalent JSON. Anchors, aliases, multi-document streams (`---` separators), and explicit-tag forms (`!!str`, `!!map`) are all supported. Multi-document YAML is returned as a JSON array (one element per document). Single-document YAML returns just the parsed value.

Inputs

NameTypeDefaultDescription
yaml*fileThe YAML document.
indentnumber (0…8)2JSON 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"'"
}'