API Documentation

Use the API endpoint to convert your data to TOON format programmatically.

New here? The TOON API guide covers errors, limits and curl, JavaScript and Python examples. Want an estimate first? Paste a sample into the TOON token calculator. For quick copy-paste conversions without code, use the TOON Chrome extension.

Convert to TOON

The primary endpoint to convert various data formats into TOON.

POSThttps://json2toon.co/api/v1/toon

Try it out

Response will appear here...

Request Body

The API accepts a JSON body with the following structure:

JSON

{
  "content": "string", // The content to convert (JSON, YAML, TOML or XML)
  "format": "string"   // Optional: "json" | "yaml" | "xml" | "toml"
}
Note: Without specifying format, the response may take longer due to auto-detection.

Example Request

curl -X POST https://json2toon.co/api/v1/toon \
  -H "Content-Type: application/json" \
  -d '{
    "content": "{\"name\": \"John\", \"age\": 30}",
    "format": "json"
  }'

Response

name: John
age: 30