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

Convert JSON to YAML. Quotes strings that need quoting; uses block-style for mappings and sequences. Configurable indentation.

Translates JSON into the equivalent YAML document. Quoting follows YAML 1.2 rules — only strings that would be misinterpreted (those that look like numbers, booleans, or YAML keywords) are quoted; everything else is unquoted. Block style is used for mappings and sequences for human readability. Set `indent` to control indentation depth (default 2).

Inputs

NameTypeDefaultDescription
json*fileThe JSON document.
indentnumber (1…8)2YAML indent width.

Response

Modes: text, json. Cache: yes (24h TTL).

Code samples

Built from the people example.

# Download or substitute the example input:
#   curl -O https://xtract.bot/examples/json-to-yaml/people.json
JSON=$(base64 -w0 < people.json)

curl -X POST https://api.xtract.bot/api/json-to-yaml \
  -H "Content-Type: application/json" \
  -H "Accept: text/plain" \
  -H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
  -H "X-Api-Key: $XTRACT_API_KEY" \
  -d '{
  "indent": 2,
  "json": "'"$JSON"'"
}'