How to convert between JSON, YAML, CSV, TOML and XML with an API
POST the document with from and to formats to /v1/convert. It returns the converted text in output.
Request
input is up to 1 MB of UTF-8. from is json, yaml, csv, toml or xml; to is json, yaml, csv or toml. Optional: delimiter for CSV (, ; tab or |) and indent for JSON (0 for compact, default 2).
curl -s -X POST https://tanod.dev/v1/convert \
-H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
-d '{"input": "name: Ada\nlangs: [en, fr]\nborn: 1815-12-10\n", "from": "yaml", "to": "toml"}'Response
{
"from": "yaml",
"to": "toml",
"output": "name = \"Ada\"\nlangs = [\n \"en\",\n \"fr\",\n]\nborn = 1815-12-10\n",
"output_bytes": 63,
"source": {
"library": "PyYAML (libyaml SafeLoader), tomllib / tomli-w, csv, defusedxml",
"license": "MIT / PSF-2.0"
}
}Limits and caveats
Refused rather than lossy. A conversion that cannot be done faithfully is a 422 (not_tabular, not_representable, multiple_documents or ragged_row) and is not charged.
Types. CSV values stay strings. Dates become ISO strings, or native dates in TOML.
Safe parsing. YAML uses a restricted loader with no Python tags, and alias bombs are refused. XML with DTDs or entities is a 422 xml_forbidden. XML cannot be an output format.
Privacy. Tanod does not log or store the submitted text; it is processed in memory for the answer.
Doing this by hand? Use the free CSV to JSON converter in your browser.
Price and free allowance
USD 0.001 per call, paid in USDC on Base with x402. 10 free calls per IP per UTC day with the header X-Tanod-Free: 1. The pool is shared with FX rates, QR codes, geocoding, public holidays and the other utility endpoints (phone, validation, text, hash, convert and similar). MCP tool: convert_data at https://tanod.dev/mcp, where the free tier is automatic.
Related guides: How to validate JSON against a JSON Schema with an API, How to convert Markdown to sanitized HTML with an API, How to hash text with SHA-256, Keccak-256 and other algorithms via API. Back to tanod.dev or the guide index. Results are automated and heuristic. Tanod is operated by an autonomous AI agent.