Data Format Conversion
Convert structured data between JSON, YAML, CSV, XML, and TOML in a single API call. Accepts any supported format as input and returns the content serialized in the target format.
Overview
Use Cases
- Transform configuration files between formats (TOML β YAML, JSON β TOML)
- Convert exported data for downstream tools that only accept specific formats
- Normalize API responses into CSV for spreadsheet ingestion
- Build developer tools and data pipeline utilities
Features
API Endpoints
Convert Format
Convert content from one structured data format to another. Supported formats: json, yaml, csv, xml, toml.
https://api.requiems.xyz/v1/convert/format
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| from | string |
Required | Source format. One of: json, yaml, csv, xml, toml |
| to | string |
Required | Target format. One of: json, yaml, csv, xml, toml |
| content | string |
Required | The content to convert, serialized as a string in the source format. |
Try it out
Live DemoRequest
Source format. One of: json, yaml, csv, xml, toml
Target format. One of: json, yaml, csv, xml, toml
The content to convert, serialized as a string in the source format.
Response Fields
| Field | Type | Description |
|---|---|---|
| result | string |
The converted content serialized in the target format. |
Code Examples
# JSON β YAML
curl -X POST https://api.requiems.xyz/v1/convert/format \
-H "requiems-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"from":"json","to":"yaml","content":"{\"name\":\"Alice\",\"age\":30}"}'
# CSV β JSON
curl -X POST https://api.requiems.xyz/v1/convert/format \
-H "requiems-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"from":"csv","to":"json","content":"name,age\nAlice,30\nBob,25"}'
import requests
url = "https://api.requiems.xyz/v1/convert/format"
headers = {
"requiems-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
# JSON β YAML
payload = {
"from": "json",
"to": "yaml",
"content": '{"name": "Alice", "age": 30}',
}
response = requests.post(url, json=payload, headers=headers)
print(response.json()["data"]["result"])
# age: 30
# name: Alice
# CSV β JSON
csv_payload = {
"from": "csv",
"to": "json",
"content": "name,age\nAlice,30\nBob,25",
}
response = requests.post(url, json=csv_payload, headers=headers)
print(response.json()["data"]["result"])
const url = 'https://api.requiems.xyz/v1/convert/format';
const headers = {
'requiems-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
};
// JSON β YAML
const res = await fetch(url, {
method: 'POST',
headers,
body: JSON.stringify({
from: 'json',
to: 'yaml',
content: JSON.stringify({ name: 'Alice', age: 30 }),
}),
});
const { data } = await res.json();
console.log(data.result);
// age: 30
// name: Alice
require 'net/http'
require 'json'
uri = URI('https://api.requiems.xyz/v1/convert/format')
request = Net::HTTP::Post.new(uri)
request['requiems-api-key'] = 'YOUR_API_KEY'
request['Content-Type'] = 'application/json'
request.body = {
from: 'json',
to: 'yaml',
content: '{"name":"Alice","age":30}'
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts JSON.parse(response.body)['data']['result']
# age: 30
# name: Alice
Error Responses
One of from, to, or content is missing, or from/to is not one of the supported format values.
The content field is not valid JSON (when from is json).
The content field is not valid YAML (when from is yaml).
The content field is not valid CSV, or a row has more columns than the header (when from is csv).
The content field is not valid XML (when from is xml).
The content field is not valid TOML (when from is toml).
The data structure is incompatible with the target format (e.g. converting a JSON array to TOML, which requires a top-level object).
The content field exceeds the 512 KB limit.