Docs

Data Format Converter

Convert between CSV, JSON, XML, YAML, and SQL in one call.

Overview

The general-purpose format converter: pass any supported source and target format, and it converts by chaining through JSON when no direct converter exists.

Features

  • Five formats: CSV, JSON, XML, YAML, SQL.
  • Automatic type inference for CSV.
  • SQL dialect and table name selection.
  • Custom XML root element.

Use cases

  • Normalizing an export before importing into another tool.
  • Turning a CSV dump into JSON for a NoSQL pipeline.

API reference

POST /api/v1/tools/convert

Convert text between CSV, JSON, XML, YAML, and SQL by pivoting through JSON when no direct converter exists.

Returns: The converted text, the row count from the last step that reported one, and the converter chain that ran.

Parameters

NameTypeRequiredDefaultDescription
from string (csv|json|xml|yaml|sql) Yes — Source format.
to string (csv|json|xml|yaml|sql) Yes — Target format.
input string Yes — The text to convert, in the source format.
autoTypes boolean No true Infer number/boolean/null types when parsing CSV rather than treating every cell as a string.
dialect string (mysql|postgres|sqlserver|sqlite) No — SQL dialect for CSV-to-SQL output. Ignored for other target formats.
table string No "data" Table name for CSV-to-SQL INSERT statements. Ignored for other target formats.
rootElement string No "root" Root XML element name for JSON-to-XML output. Ignored for other target formats.

Example

curl -X POST https://data-migration-tools.com/api/v1/tools/convert \
  -H "Content-Type: application/json" \
  -d '{"from":"csv","to":"json","input":"id,name\n1,Ada\n2,Grace"}'

See the full API reference for all examples and error codes.