JSON → YAML
Try it interactively →POST /api/json-to-yamlConvert JSON to YAML. Quotes strings that need quoting; uses block-style for mappings and sequences. Configurable indentation.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| json* | file | — | The JSON document. |
| indent | number (1…8) | 2 | YAML 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"'"
}'