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

Convert CSV files to a JSON array of objects via HTTP. RFC 4180 parsing with quoted fields, embedded commas, and escapes. Header row → object keys.

Reads RFC 4180-style CSV (with quoted fields, doubled-quote escapes, and embedded commas/newlines) and emits a JSON array. The first row is treated as the header — each subsequent row becomes an object keyed by header name. All values are emitted as JSON strings (CSV does not carry types). If your downstream wants numbers or booleans, parse them client-side or use `json-format` afterwards with a transformation step. Custom delimiters (TSV with `\t`, semicolons for European spreadsheets) are supported via the `delimiter` option.

Inputs

NameTypeDefaultDescription
csv*fileThe CSV document.
prettyPrintbooleanfalseIndent the JSON output with two spaces.

Response

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

Code samples

Built from the people example.

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

curl -X POST https://api.xtract.bot/api/csv-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 '{
  "csv": "'"$CSV"'"
}'