Skip to content
ToolsOnDuty - free online tools
ToolsOnDuty / docs
Browse documentation

Reference / Data Format

Data Format API

6 endpoints for data format workflows. Every call requires bearer authentication and uses the standard ToolsOnDuty response envelope.

Try it

Runs a real request from your browser to your own ToolsOnDuty account. Your key is only kept in this page and is never stored.

POST/v1/convert/json-csv1 credit / call

JSON <-> CSV

Convert a JSON array of objects to CSV, or CSV back to a JSON array of objects.

ParameterTypeRequiredDescription
textstringYesmode=to-csv: JSON text. mode=to-json: CSV text.
modestringNoto-csv | to-json. Default: to-csv.

Request

curl -X POST https://toolsonduty.com/api/v1/convert/json-csv \
  -H "Authorization: ******" \
  -H "Content-Type: application/json" \
  -d '{"text":"[{\"a\":1,\"b\":2}]","mode":"to-csv"}'

Response

{
  "ok": true,
  "data": {
    "result": "a,b\n1,2"
  }
}
POST/v1/convert/csv-markdown1 credit / call

CSV <-> Markdown table

Convert CSV to a Markdown table, or a Markdown table back to CSV.

ParameterTypeRequiredDescription
textstringYesmode=to-markdown: CSV text. mode=to-csv: Markdown table text.
modestringNoto-markdown | to-csv. Default: to-markdown.

Request

curl -X POST https://toolsonduty.com/api/v1/convert/csv-markdown \
  -H "Authorization: ******" \
  -H "Content-Type: application/json" \
  -d '{"text":"a,b\n1,2","mode":"to-markdown"}'

Response

{
  "ok": true,
  "data": {
    "result": "| a | b |\n| --- | --- |\n| 1 | 2 |"
  }
}
POST/v1/convert/json-xml1 credit / call

JSON to XML

Convert a JSON document to XML.

ParameterTypeRequiredDescription
textstringYesJSON text.

Request

curl -X POST https://toolsonduty.com/api/v1/convert/json-xml \
  -H "Authorization: ******" \
  -H "Content-Type: application/json" \
  -d '{"text":"{\"a\":1}"}'

Response

{
  "ok": true,
  "data": {
    "result": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<root>\n  <a>1</a>\n</root>"
  }
}
POST/v1/convert/json-toml1 credit / call

JSON <-> TOML

Convert JSON to TOML, or TOML back to JSON.

ParameterTypeRequiredDescription
textstringYesmode=to-toml: JSON text. mode=to-json: TOML text.
modestringNoto-toml | to-json. Default: to-toml.

Request

curl -X POST https://toolsonduty.com/api/v1/convert/json-toml \
  -H "Authorization: ******" \
  -H "Content-Type: application/json" \
  -d '{"text":"{\"a\":1}","mode":"to-toml"}'

Response

{
  "ok": true,
  "data": {
    "result": "a = 1"
  }
}
POST/v1/convert/json-typescript1 credit / call

JSON to TypeScript

Generate a TypeScript interface from a JSON document.

ParameterTypeRequiredDescription
textstringYesJSON text.
rootNamestringNoName for the root interface. Default: Root.

Request

curl -X POST https://toolsonduty.com/api/v1/convert/json-typescript \
  -H "Authorization: ******" \
  -H "Content-Type: application/json" \
  -d '{"text":"{\"id\":1,\"name\":\"a\"}"}'

Response

{
  "ok": true,
  "data": {
    "result": "export interface Root {\n  id: number;\n  name: string;\n}"
  }
}
POST/v1/convert/json-go1 credit / call

JSON to Go struct

Generate a Go struct definition from a JSON document.

ParameterTypeRequiredDescription
textstringYesJSON text.
rootNamestringNoName for the root struct. Default: Root.

Request

curl -X POST https://toolsonduty.com/api/v1/convert/json-go \
  -H "Authorization: ******" \
  -H "Content-Type: application/json" \
  -d '{"text":"{\"id\":1,\"name\":\"a\"}"}'

Response

{
  "ok": true,
  "data": {
    "result": "type Root struct {\n\tId int `json:\"id\"`\n\tName string `json:\"name\"`\n}"
  }
}