Convert TOON (Token-Oriented Object Notation) into production-ready Kotlin data classes directly inside JetBrains IDEs.
An IntelliJ IDEA / Android Studio plugin that generates Kotlin data classes from TOON Token-Oriented Object Notation — a lightweight, human-readable format for defining data structures.
TOON is designed to be simpler than JSON for quickly sketching out data models. Write your schema in plain text and instantly get production-ready Kotlin code.
- 🔄 Instant Conversion — Write TOON, see Kotlin data classes in real-time preview
- 📦 Nested Objects — Supports deeply nested structures with inner class generation
- 📋 Lists & Object Lists — Arrays and table-style data with headers and rows
- 🏷️ 11 Annotation Frameworks — Gson, Jackson, Moshi, Fastjson, kotlinx.serialization, LoganSquare, Firebase, and more
- ⚙️ Advanced Settings — Full control via 4-tab settings dialog (Property, Annotation, Other, Extensions)
- 🧠 Smart Type Inference — Automatically detects
Int,Long,Double,Boolean,Stringfrom values - ✍️ Format & Validate — Built-in TOON formatter and validator
- Open IntelliJ IDEA or Android Studio
- Go to Settings → Plugins → Marketplace
- Search for TOONToKotlinClass
- Click Install and restart
- Right-click in any Kotlin file → Generate → Generate Kotlin Data Class from TOON
- Write or paste your TOON input on the left
- See the generated Kotlin code on the right in real-time
- Click OK to insert the code
TOON uses indentation-based nesting with simple key: value pairs.
TOON Input:
user:
id: 101
name: Saroj
email: saroj@example.com
is_active: true
balance: 999.99
address:
city: Bangalore
zip_code: 560001
tags[3]: android,kotlin,dev
orders[2]{order_id,item,price}:
1,Laptop,75999.50
2,Mouse,499.00
Generated Kotlin:
data class User(
val id: Int,
val name: String,
val email: String,
val isActive: Boolean,
val balance: Double,
val address: Address,
val tags: List<String>,
val orders: List<Order>
)
data class Address(
val city: String,
val zipCode: Int
)
data class Order(
val orderId: Int,
val item: String,
val price: Double
)| Syntax | Description | Example |
|---|---|---|
key: value |
Simple property | name: Saroj |
key: (with indented children) |
Nested object | address: → city: NY |
key[N]: a,b,c |
List of N items | tags[3]: a,b,c |
key[N]{h1,h2}: rows |
Object list with headers | items[2]{id,name}: ... |
| Value | Inferred Type |
|---|---|
42 |
Int |
100L |
Long |
3.14 |
Double |
true / false |
Boolean |
| Everything else | String |
Click Advanced in the main dialog to access the full settings:
- Keyword —
valorvar - Type — Non-Nullable, Nullable, or Auto Determine
- Default Value Strategy — No default, Non-null default, or Null when nullable
Choose from 11 annotation frameworks:
| Framework | Annotation |
|---|---|
| None | (no annotation) |
| Gson | @SerializedName("key") |
| Jackson | @JsonProperty("key") |
| Moshi (Reflect) | @Json(name = "key") |
| Moshi (Codegen) | @Json(name = "key") |
| Fastjson | @JSONField(name = "key") |
| kotlinx.serialization | @SerialName("key") + @Serializable |
| LoganSquare | @JsonField(name = "key") + @JsonObject |
| Firebase | @PropertyName("key") |
| Custom | Your own template |
- Append original TOON as comment
- Enable alphabetical ordering
- Enable inner class model
- Configurable indent & parent class template
@Keepannotation (standard / AndroidX)- Parcelable support (
@Parcelize) - Property & class prefix/suffix
- Disable data class / use member variables
- Internal visibility modifier
- Gson
@Exposeannotation
git clone https://github.com/sarojsahu/TOONToKotlinClass.git
cd TOONToKotlinClass
./gradlew buildPluginThe plugin ZIP will be in build/distributions/.
./gradlew runIdeContributions are welcome! Feel free to:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Saroj Sahu
- 📧 Email: sarojsahu14369@gmail.com
- 🐙 GitHub: sarojsahu-dev
If you find this plugin useful, give it a ⭐ on GitHub — it helps others discover it!
