Convert Data
Standard · 1 creditConvert structured data between JSON, YAML, CSV, XML, and TOML.
POST /api/convert-data
Section titled “POST /api/convert-data”Parameters
Section titled “Parameters”| Field | Type | Required | Description |
|---|---|---|---|
input | string | Yes | Data to convert |
from | string | Yes | Source format: json, yaml, csv, xml, toml |
to | string | Yes | Target format: json, yaml, csv, xml, toml |
Response
Section titled “Response”| Field | Type | Description |
|---|---|---|
output | string | Converted data |
from_format | string | Source format used |
to_format | string | Target format used |
Examples
Section titled “Examples”JSON to YAML
Section titled “JSON to YAML”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"}YAML to TOML
Section titled “YAML to TOML”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"}Errors
Section titled “Errors”- 400 — Source and target formats are the same, or input cannot be parsed in the specified format.
See Errors for the standard error shape.