Skip to main content

toonizasion 1.0.1 copy "toonizasion: ^1.0.1" to clipboard
toonizasion: ^1.0.1 copied to clipboard

A Dart implementation of Token-Oriented Object Notation (TOON), a compact and LLM-friendly data format.

example/example.dart

import 'package:toonizasion/toonizasion.dart';

void main() {
  final data = {
    'context': {
      'task': 'Our favorite hikes together',
      'location': 'Boulder',
      'season': 'spring_2025'
    },
    'friends': ['ana', 'luis', 'sam'],
    'hikes': [
      {
        'id': 1,
        'name': 'Blue Lake Trail',
        'distanceKm': 7.5,
        'elevationGain': 320,
        'companion': 'ana',
        'wasSunny': true
      },
      {
        'id': 2,
        'name': 'Ridge Overlook',
        'distanceKm': 9.2,
        'elevationGain': 540,
        'companion': 'luis',
        'wasSunny': false
      },
      {
        'id': 3,
        'name': 'Wildflower Loop',
        'distanceKm': 5.1,
        'elevationGain': 180,
        'companion': 'sam',
        'wasSunny': true
      }
    ]
  };

  // 1. Encode Dart object to TOON
  final toonString = toToon(data);
  print('--- TOON ENCODED ---');
  print(toonString);

  // 2. Decode TOON string back to Dart
  final decodedData = fromToon(toonString);
  print('--- DECODED FROM TOON (JSON-like) ---');
  print(decodedData['context']['task']); // Our favorite hikes together
  print('Friends count: ${decodedData['friends'].length}'); // 3

  final firstHike = decodedData['hikes'][0];
  print('First hike: ${firstHike['name']} with ${firstHike['companion']}');
}
0
likes
150
points
9
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Dart implementation of Token-Oriented Object Notation (TOON), a compact and LLM-friendly data format.

License

MIT (license)

Dependencies

meta

More

Packages that depend on toonizasion