JSON to Toon Converter
A VS Code extension that converts JSON files into the compact Toon format. Toon is designed to be less verbose than JSON and YAML, saving tokens while maintaining readability through table structures and inline CSV.
Features
- Convert JSON to Toon: Instantly transform your current JSON document.
- Token Efficiency: Reduces structure overhead by removing quotes and using compact syntax.
- Smart Formatting:
- Inline CSV: Primitive arrays are compressed into single lines (e.g.,
friends[3]: ana,luis,sam).
- Table Format: Uniform arrays of objects are converted to compact tables with a single schema header.
Usage
- Open a
.json file in VS Code.
- Open the Command Palette (
Ctrl+Shift+P or Cmd+Shift+P).
- Run the command: Convert JSON to Toon.
The extension will replace the content of the active editor with the converted Toon format.
Example
Input (JSON):
{
"context": {
"task": "Hiking",
"location": "Boulder"
},
"friends": ["ana", "luis"],
"hikes": [
{ "id": 1, "name": "Blue Lake", "km": 7.5 },
{ "id": 2, "name": "Ridge", "km": 9.2 }
]
}
Output (Toon):
context:
task: Hiking
location: Boulder
friends[2]: ana,luis
hikes[2]{id,name,km}:
1,Blue Lake,7.5
2,Ridge,9.2
Requirements
- VS Code 1.90.0 or higher.
Contributing
Contributions are welcome! Here's how you can help:
- Fork the Project: Create your own copy of the repository.
- Create your Feature Branch:
git checkout -b feature/AmazingFeature
- Commit your Changes:
git commit -m 'Add some AmazingFeature'
- Push to the Branch:
git push origin feature/AmazingFeature
- Open a Pull Request
Development
- Clone the repository.
- Run
npm install to install dependencies.
- Press F5 in VS Code to launch the Extension Development Host and test your changes.
Buy me a pizza
