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

Convert JSON to TOML. JSON objects become TOML tables; arrays-of-objects become arrays-of-tables; nested keys are flattened with dot notation.

Translates a JSON document into TOML. Object keys become table entries; nested objects become nested tables; arrays-of-objects become arrays-of-tables (`[[tableName]]` syntax). Strings, numbers, booleans, and arrays-of-scalars pass through unchanged. TOML cannot represent every JSON document — arrays containing mixed types or `null` values produce an error. The schema is documented in the response when this happens.

Inputs

NameTypeDefaultDescription
json*stringJSON object as a string.

Response

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

Code samples

Built from the config example.


curl -X POST https://api.xtract.bot/api/json-to-toml \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
  -H "X-Api-Key: $XTRACT_API_KEY" \
  -d '{
  "json": "{\"title\":\"config\",\"server\":{\"host\":\"0.0.0.0\",\"port\":8080,\"features\":[\"a\",\"b\"]}}"
}'