API Documentation
Convert between JSON and TOON formats programmatically
Base URL
https://jsontoon.soluzent.com/api/convertEndpoint
POST /api/convertConverts between JSON and TOON formats based on the specified type.
Request
Headers
Content-Type: application/json
Body
{
"data": "your JSON or TOON data here",
"type": "json-to-toon" | "toon-to-json"
}Parameters:
- data (string, required): The JSON object or TOON string to convert
- type (string, required): Conversion type
- •
"json-to-toon"- Convert JSON to flattened TOON format - •
"toon-to-json"- Convert flattened TOON back to JSON
- •
Response
Success (200)
{
"success": true,
"result": "converted data here (string for TOON or object for JSON)"
}Error (400)
{
"success": false,
"error": "error message"
}Examples
JSON to TOON
curl -X POST https://jsontoon.soluzent.com/api/convert \
-H "Content-Type: application/json" \
-d '{
"data": {
"users": [
{ "id": 1, "name": "Alice", "role": "admin", "salary": 75000 },
{ "id": 2, "name": "Bob", "role": "user", "salary": 65000 }
],
"group": "teamA",
"active": true
},
"type": "json-to-toon"
}'Response:
{
"success": true,
"result": "users[2]{id,name,role,salary}:
1,Alice,admin,75000
2,Bob,user,65000
group: teamA
active: true"
}TOON to JSON
curl -X POST https://jsontoon.soluzent.com/api/convert \
-H "Content-Type: application/json" \
-d '{
"data": "users[2]{id,name,role,salary}:\n1,Alice,admin,75000\n2,Bob,user,65000\ngroup: teamA\nactive: true",
"type": "toon-to-json"
}'Response:
{
"success": true,
"result": {
"users": [
{ "id": 1, "name": "Alice", "role": "admin", "salary": 75000 },
{ "id": 2, "name": "Bob", "role": "user", "salary": 65000 }
],
"group": "teamA",
"active": true
}
}JavaScript Example
// JSON to TOON
const response = await fetch('https://jsontoon.soluzent.com/api/convert', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
data: { name: 'John', age: 30, active: true },
type: 'json-to-toon'
})
});
const { result } = await response.json();
console.log(result);
// TOON to JSON
const toonResponse = await fetch('https://jsontoon.soluzent.com/api/convert', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
data: "name: John\nage: 30\nactive: true",
type: 'toon-to-json'
})
});
const { result: jsonResult } = await toonResponse.json();
console.log(jsonResult);Error Codes
400 Bad Request
Missing required fields (data, type) or invalid type value
400 Invalid Data
Malformed JSON or TOON data that cannot be parsed