Skip to content

Convert Data

Standard · 1 credit

Convert structured data between JSON, YAML, CSV, XML, and TOML.

FieldTypeRequiredDescription
inputstringYesData to convert
fromstringYesSource format: json, yaml, csv, xml, toml
tostringYesTarget format: json, yaml, csv, xml, toml
FieldTypeDescription
outputstringConverted data
from_formatstringSource format used
to_formatstringTarget format used
Terminal window
curl -X POST https://morso.dev/api/convert-data \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"input": "{\"name\": \"morso\", \"version\": \"1.0\"}", "from": "json", "to": "yaml"}'
{
"output": "name: morso\nversion: \"1.0\"\n",
"from_format": "json",
"to_format": "yaml"
}
Terminal window
curl -X POST https://morso.dev/api/convert-data \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"input": "name: morso\nport: 8080", "from": "yaml", "to": "toml"}'
{
"output": "name = \"morso\"\nport = 8080\n",
"from_format": "yaml",
"to_format": "toml"
}
  • 400 — Source and target formats are the same, or input cannot be parsed in the specified format.

See Errors for the standard error shape.