๐ TOON Library Support
Ready-to-use implementations for your favorite programming languages and frameworks
Copy and integrate TOON conversion directly into your projects
Select Language/Framework
Select Implementation
JavaScript - Vanilla
Basic JavaScript TOON Converter
// TOON Format Converter - JavaScript
const toonConverter = {
jsonToToon: (obj) => {
if (obj === null) return 'n';
if (typeof obj === 'boolean') return obj ? 'b1' : 'b0';
if (typeof obj === 'number') return '#' + obj;
if (typeof obj === 'string') {
return 's' + obj.length + ':' + obj;
}
if (Array.isArray(obj)) {
return '[' + obj.map(toonConverter.jsonToToon).join('') + ']';
}
if (typeof obj === 'object') {
const pairs = Object.entries(obj)
.map(([k, v]) => toonConverter.jsonToToon(k) + toonConverter.jsonToToon(v))
.join('');
return '{' + pairs + '}';
}
},
toonToJson: (toonStr) => {
let index = 0;
const parse = () => {
const char = toonStr[index++];
if (char === 'n') return null;
if (char === 'b') return toonStr[index++] === '1';
if (char === '#') {
let num = '';
while (index < toonStr.length && toonStr[index] !== ';') {
num += toonStr[index++];
}
return Number(num);
}
if (char === 's') {
let len = '';
while (toonStr[index] !== ':') len += toonStr[index++];
index++; // skip ':'
const str = toonStr.substring(index, index + Number(len));
index += Number(len);
return str;
}
if (char === '[') {
const arr = [];
while (toonStr[index] !== ']') arr.push(parse());
index++; // skip ']'
return arr;
}
if (char === '{') {
const obj = {};
while (toonStr[index] !== '}') {
const key = parse();
const value = parse();
obj[key] = value;
}
index++; // skip '}'
return obj;
}
};
return parse();
}
};
// Usage
const data = { name: "John", age: 30 };
const toon = toonConverter.jsonToToon(data);
const restored = toonConverter.toonToJson(toon);
console.log(toon, restored);๐
Easy Integration
Copy-paste ready code snippets that work out of the box with minimal configuration
๐ง
Full Examples
Complete working examples including server APIs, client libraries, and data models
๐ฆ
Production Ready
Enterprise-grade implementations with error handling and best practices included
โจ Comprehensive Language Support
๐ Web & Frontend
- โ JavaScript (Vanilla, React, Next.js, Node.js)
- โ TypeScript (Full Type Support)
๐ Backend & Data
- โ Python (Flask, FastAPI)
- โ Java (Spring Boot)
โ๏ธ Modern Languages
- โ Rust (Cargo)
- โ Go (Gin Framework)
๐ป More Languages
- โ C# / .NET Core & ASP.NET
- โ PHP (Laravel)
- โ Ruby (Rails)
- โ Swift (iOS/macOS)
- โ Kotlin (Android/JVM)
๐ก Integration Tips
- โจ All code examples include error handling and validation
- ๐ Data is processed locally - no external API calls required
- ๐ฆ Dependencies are minimal and production-tested
- ๐งช Use the examples as starting points for your specific needs
- ๐ Test with the live converter above before deploying
- ๐ Refer to language-specific documentation for advanced features