TOON Format Examples: Real-World Use Cases

Practical TOON examples from customer analytics, chatbots, RAG systems, and enterprise applications

Published: January 2025 • 12 min read

TOON format excels in real-world applications where token efficiency directly impacts cost and performance. This guide showcases practical examples across different industries and use cases, demonstrating how TOON optimizes data for LLM applications.

Each example includes context, the TOON implementation, and explanation of token savings. You can test these examples with our TOON Validator and convert your own data using JSON to TOON converter.

Example 1: Customer Churn Analysis

Use Case: AI-powered customer analytics platform analyzing churn risk for SaaS subscription business

TOON Format

# Customer churn analysis - Q4 2024
# Task: Identify high-risk customers and recommend retention strategies

customers[10]{id,name,company,mrr,tenure_months,support_tickets,nps_score,churn_risk}:
  C001,Sarah Mitchell,Acme Corp,299,24,2,9,0.15
  C002,Michael Chen,StartupXYZ,999,36,1,10,0.08
  C003,Jennifer Kumar,TechVentures,99,6,8,4,0.82
  C004,David Park,Innovation Labs,499,18,3,7,0.35
  C005,Emma Wilson,Digital Solutions,99,3,12,3,0.89
  C006,James Rodriguez,Enterprise Co,1499,48,0,9,0.05
  C007,Lisa Thompson,Cloud Systems,299,15,5,6,0.48
  C008,Robert Kim,DataFlow Inc,799,30,2,8,0.22
  C009,Maria Garcia,AgileWorks,199,9,7,5,0.71
  C010,Thomas Anderson,ScaleUp Ltd,599,21,4,7,0.38

analysis_parameters:
  high_risk_threshold: 0.7
  focus_metrics: "support_tickets, tenure_months, nps_score"
  retention_budget: 5000
  
task: |
  Analyze the customer data and:
  1. Identify customers with churn_risk > 0.7
  2. Determine common patterns among high-risk customers
  3. Recommend specific retention strategies for top 3 at-risk customers
  4. Estimate retention cost vs customer lifetime value

Token Efficiency:

  • JSON equivalent: ~420 tokens
  • TOON format: ~210 tokens
  • Savings: 50% (210 tokens saved)
  • Cost impact: $0.0021 saved per API call at GPT-4 pricing

Example 2: E-commerce Order Processing

Use Case: AI assistant helping customers track orders and suggest related products

TOON Format

# Customer order history for personalized recommendations

customer:
  id: "U-45892"
  name: "Alex Johnson"
  email: "[email protected]"
  tier: "Gold"
  lifetime_value: 3247.50

recent_orders[5]{order_id,date,total,status,items_count}:
  ORD-1001,2025-01-10,149.99,delivered,3
  ORD-1002,2025-01-05,89.50,delivered,2
  ORD-1003,2024-12-28,234.75,delivered,5
  ORD-1004,2024-12-15,67.99,delivered,1
  ORD-1005,2024-12-01,445.00,delivered,4

current_cart[3]{product_id,name,quantity,price}:
  P-8472,Wireless Headphones,1,129.99
  P-3391,USB-C Cable,2,15.99
  P-7621,Phone Case,1,24.99

browsing_history[4]: "laptops", "monitors", "keyboards", "desk accessories"

task: |
  Based on the customer's purchase history and current cart:
  1. Recommend 3 complementary products
  2. Suggest bundle deals to increase order value
  3. Identify if customer qualifies for free shipping
  4. Personalize the checkout message

Why TOON Works Here:

E-commerce systems frequently pass order history and cart data to LLMs for personalization. The structured array notation for orders and cart items reduces token count significantly, allowing more browsing history and customer context within the same token budget.

Example 3: Financial Transaction Analysis

Use Case: Fraud detection system analyzing transaction patterns for anomaly detection

TOON Format

# Real-time fraud detection analysis

account:
  account_id: "ACC-789012"
  holder: "Sarah Mitchell"
  account_type: "checking"
  current_balance: 12847.50
  avg_monthly_spend: 3200.00

recent_transactions[15]{txn_id,date,merchant,amount,category,location,flagged}:
  TX001,2025-01-15T14:23:00Z,Amazon,89.99,shopping,Seattle WA,false
  TX002,2025-01-15T14:25:00Z,Gas Station,45.00,fuel,Seattle WA,false
  TX003,2025-01-15T14:27:00Z,Electronics Store,1299.99,shopping,Miami FL,true
  TX004,2025-01-15T14:28:00Z,Luxury Store,2499.00,shopping,Miami FL,true
  TX005,2025-01-15T09:15:00Z,Coffee Shop,5.75,food,Seattle WA,false
  TX006,2025-01-14T18:30:00Z,Restaurant,67.50,food,Seattle WA,false
  TX007,2025-01-14T12:00:00Z,Grocery Store,134.28,groceries,Seattle WA,false
  TX008,2025-01-13T19:45:00Z,Movie Theater,32.00,entertainment,Seattle WA,false
  TX009,2025-01-13T15:20:00Z,Pharmacy,18.99,healthcare,Seattle WA,false
  TX010,2025-01-12T10:30:00Z,Gas Station,48.50,fuel,Seattle WA,false
  TX011,2025-01-11T20:15:00Z,Restaurant,89.75,food,Seattle WA,false
  TX012,2025-01-11T14:00:00Z,Online Store,156.00,shopping,Seattle WA,false
  TX013,2025-01-10T16:45:00Z,Utility Bill,125.00,bills,Seattle WA,false
  TX014,2025-01-10T11:20:00Z,Coffee Shop,6.50,food,Seattle WA,false
  TX015,2025-01-09T13:00:00Z,Grocery Store,98.45,groceries,Seattle WA,false

fraud_indicators:
  geographic_anomaly: true  # Miami FL purchases while normal pattern is Seattle WA
  rapid_succession: true    # Multiple high-value purchases within 3 minutes
  unusual_amount: true      # $3,798.99 total in 3 minutes vs avg $150/transaction
  location_impossible: true # 2,800 miles traveled in 2 hours

task: |
  Analyze the flagged transactions and:
  1. Assess fraud probability (0-100%)
  2. Explain suspicious patterns detected
  3. Recommend immediate action (block/allow/verify)
  4. Suggest customer verification questions

Real-World Impact:

Financial institutions process millions of fraud detection requests daily. With TOON's 50% token reduction, a bank processing 100,000 fraud checks per day saves approximately $5,000/month in API costs while maintaining comprehensive transaction context for accurate detection.

Example 4: RAG System - Knowledge Base Query

Use Case: Customer support chatbot retrieving relevant documentation to answer technical questions

TOON Format

# RAG context for technical support query

user_query: "How do I configure SSL certificates for my domain?"

user_context:
  user_id: "U-34521"
  account_type: "business"
  technical_level: "intermediate"
  current_plan: "professional"

retrieved_documents[5]{doc_id,title,relevance,last_updated,snippet}:
  D847,SSL Certificate Installation Guide,0.94,2024-12-15,"To install an SSL certificate: 1. Generate CSR 2. Submit to CA 3. Download certificate files..."
  D392,Domain Configuration Best Practices,0.87,2024-11-28,"SSL/TLS configuration requires proper certificate chain. Ensure intermediate certificates are included..."
  D615,Troubleshooting SSL Errors,0.82,2024-12-01,"Common SSL errors: Certificate mismatch ERR_CERT_COMMON_NAME_INVALID occurs when domain doesn't match..."
  D204,Security Setup Walkthrough,0.76,2024-10-15,"Navigate to Security > SSL/TLS settings. Click Add Certificate. Upload your certificate and private key..."
  D981,Automatic SSL with Let's Encrypt,0.71,2024-12-10,"Enable automatic SSL: Go to Domains > Select domain > Enable Auto SSL. System will obtain free certificate..."

previous_conversation[3]{role,message}:
  user,"I just bought a new domain"
  assistant,"Congratulations! I can help you set up your domain. What would you like to configure first?"
  user,"I need to set up HTTPS for security"

instruction: |
  Using the retrieved documentation above:
  1. Provide a clear, step-by-step answer to the user's question
  2. Recommend the easiest SSL option for their technical level
  3. Cite specific document IDs where appropriate
  4. Offer to help with next steps after SSL setup

Token Efficiency in RAG:

RAG systems are prime candidates for TOON optimization. This example includes 5 retrieved documents with metadata:

  • JSON format: ~280 tokens for document metadata
  • TOON format: ~140 tokens for same data
  • Result: Can include 10 documents in TOON vs 5 in JSON (same token budget)

Example 5: Healthcare Clinical Decision Support

Use Case: AI assistant helping physicians analyze patient data and suggest diagnoses

TOON Format

# Clinical decision support - Patient case analysis

patient:
  id: "PT-892341"
  age: 45
  gender: "female"
  weight_kg: 68
  height_cm: 165

chief_complaint: "Persistent fatigue and joint pain for 3 months"

vital_signs:
  blood_pressure: "138/88"
  heart_rate: 82
  temperature_c: 37.1
  respiratory_rate: 16

lab_results[8]{test,value,unit,reference_range,flag}:
  Hemoglobin,11.2,g/dL,12.0-16.0,low
  WBC Count,12500,cells/mcL,4500-11000,high
  ESR,45,mm/hr,0-20,high
  CRP,15.2,mg/L,0-5,high
  Rheumatoid Factor,42,IU/mL,0-14,high
  Anti-CCP,68,units,0-20,high
  TSH,2.8,mIU/L,0.4-4.0,normal
  Vitamin D,18,ng/mL,30-100,low

symptoms[6]: "fatigue", "joint pain", "morning stiffness", "swelling in hands", "decreased appetite", "weight loss"

medical_history[3]: "hypothyroidism (controlled)", "vitamin D deficiency", "no autoimmune disorders"

current_medications[2]{medication,dosage,frequency}:
  Levothyroxine,75mcg,daily
  Vitamin D3,2000IU,daily

task: |
  Based on patient presentation and lab results:
  1. List top 3 differential diagnoses with supporting evidence
  2. Recommend additional tests needed for definitive diagnosis
  3. Suggest initial treatment approach
  4. Identify any urgent concerns requiring immediate attention

Healthcare Applications:

Medical AI assistants need comprehensive patient data for accurate recommendations. TOON's structured arrays for lab results, medications, and symptoms allow clinicians to provide complete context without exceeding token limits, ensuring safer and more accurate AI-assisted diagnoses.

Example 6: Sales Pipeline Forecasting

Use Case: AI-powered sales analytics predicting quarterly revenue and identifying at-risk deals

TOON Format

# Q1 2025 Sales Pipeline Analysis

pipeline_deals[12]{deal_id,company,value,stage,probability,days_in_stage,last_contact,rep}:
  D1001,Acme Corp,125000,negotiation,0.80,12,2025-01-14,Sarah M
  D1002,TechStart,45000,proposal,0.60,8,2025-01-13,Michael C
  D1003,Enterprise Co,340000,contract_review,0.90,5,2025-01-15,Sarah M
  D1004,StartupXYZ,28000,discovery,0.30,22,2024-12-28,Jennifer K
  D1005,Global Industries,580000,negotiation,0.75,18,2025-01-10,David P
  D1006,Innovation Labs,95000,proposal,0.65,10,2025-01-12,Michael C
  D1007,Cloud Systems,67000,qualified,0.40,15,2025-01-08,Emma W
  D1008,Digital Solutions,156000,negotiation,0.85,7,2025-01-14,Sarah M
  D1009,DataFlow Inc,89000,proposal,0.55,12,2025-01-11,Jennifer K
  D1010,AgileWorks,234000,contract_review,0.95,3,2025-01-15,David P
  D1011,ScaleUp Ltd,45000,discovery,0.35,19,2025-01-05,Emma W
  D1012,FutureTech,178000,negotiation,0.70,14,2025-01-13,Michael C

team_performance[5]{rep,deals_closed_q4,quota,current_pipeline,forecast}:
  Sarah M,8,500000,623000,498400
  Michael C,6,400000,328000,196800
  Jennifer K,4,350000,117000,40950
  David P,7,450000,814000,651200
  Emma W,3,300000,112000,39200

quarter_target: 2000000
days_remaining: 75

task: |
  Analyze the sales pipeline and provide:
  1. Probability-weighted revenue forecast for Q1
  2. Identify deals at risk (stalled >15 days or probability dropping)
  3. Recommend which deals to prioritize for each rep
  4. Assess if team will hit the $2M quarter target
  5. Suggest specific actions to close the gap if needed

Business Impact:

Sales teams analyze pipeline data multiple times daily. TOON's efficiency allows including complete deal context, team performance metrics, and historical data in a single LLM prompt - enabling comprehensive analysis without hitting token limits.

Example 7: Multi-Turn Chatbot Conversation

Use Case: Customer service chatbot maintaining conversation context across multiple interactions

TOON Format

# Customer service conversation context

session:
  session_id: "S-7821934"
  started: "2025-01-15T14:20:00Z"
  duration_minutes: 8
  channel: "web_chat"

customer:
  id: "C-34892"
  name: "Alex Johnson"
  tier: "premium"
  account_age_days: 487

conversation[12]{role,message,timestamp,intent}:
  user,"Hi I need help with my recent order","14:20:15",order_inquiry
  assistant,"Hello Alex! I'd be happy to help. What's your order number?","14:20:18",greeting
  user,"Order #ORD-5628","14:20:45",provide_info
  assistant,"I found order #ORD-5628 placed on Jan 10 for $234.50. How can I assist?","14:20:52",order_found
  user,"It says delivered but I didn't receive it","14:21:30",delivery_issue
  assistant,"I'm sorry to hear that. Let me check the tracking details.","14:21:35",acknowledge
  user,"The tracking shows it was left at my door","14:22:10",provide_detail
  assistant,"I see it was marked delivered on Jan 12 at 2:45 PM. Did you check with neighbors?","14:22:20",troubleshoot
  user,"Yes I checked everywhere. Nothing.","14:23:15",negative_response
  assistant,"I understand this is frustrating. I can either reship the order or process a full refund.","14:23:25",offer_solution
  user,"I'd like a refund please","14:24:00",choose_option
  assistant,"Absolutely. I'm processing a $234.50 refund to your original payment method.","14:24:10",action_taken

order_details:
  order_id: "ORD-5628"
  order_date: "2025-01-10"
  items[3]{product,quantity,price}:
    Wireless Keyboard,1,79.99
    Mouse Pad,2,12.99
    USB Hub,1,34.99
  shipping_address: "123 Main St, Boston MA 02101"
  carrier: "UPS"
  tracking: "1Z999AA10123456784"
  delivery_status: "delivered"
  delivery_date: "2025-01-12T14:45:00Z"

previous_interactions[2]{date,issue,resolution}:
  2024-11-20,product_question,answered
  2024-09-15,billing_inquiry,resolved

actions_taken[1]{action,amount,status}:
  refund_processed,234.50,pending

task: "Continue the conversation. Inform customer about refund timeline and offer discount on next purchase."

Conversation Context Efficiency:

Chatbots benefit enormously from TOON's compact conversation history. This example includes 12 conversation turns, order details, and customer history - all in ~180 tokens vs ~360 tokens in JSON. Result: 2x longer conversation context or more customer background within the same token budget.

Example 8: System Log Analysis for Debugging

Use Case: DevOps AI assistant analyzing application logs to diagnose production issues

TOON Format

# Production incident investigation - API latency spike

incident:
  incident_id: "INC-2847"
  severity: "high"
  started: "2025-01-15T10:45:00Z"
  duration_minutes: 23
  affected_service: "payment-api"

error_logs[10]{timestamp,level,service,message,user_id,response_time_ms}:
  10:45:12,ERROR,payment-api,"Database connection timeout",U-4821,8500
  10:45:15,ERROR,payment-api,"Database connection timeout",U-3092,8700
  10:45:18,WARN,payment-api,"Retry attempt 1 failed",U-4821,9200
  10:45:23,ERROR,payment-api,"Transaction rollback",U-5634,8300
  10:45:28,ERROR,payment-api,"Database connection timeout",U-7821,8900
  10:45:35,ERROR,payment-api,"Maximum retry attempts exceeded",U-4821,15000
  10:46:02,ERROR,payment-api,"Database connection timeout",U-2341,8600
  10:46:15,WARN,payment-api,"Connection pool exhausted",null,null
  10:46:30,ERROR,payment-api,"Service unavailable",U-9102,12000
  10:46:45,ERROR,payment-api,"Database connection timeout",U-6723,9100

system_metrics:
  cpu_usage: "45%"
  memory_usage: "78%"
  database_connections:
    active: 95
    max: 100
    waiting: 23
  request_rate: "450 req/min"
  avg_response_time: "8700ms"
  error_rate: "28%"

normal_baseline:
  avg_response_time: "120ms"
  error_rate: "0.5%"
  database_connections_avg: 35

recent_changes[3]{time,type,description}:
  2025-01-15T09:30:00Z,deployment,"v2.4.3 deployed to production"
  2025-01-15T08:00:00Z,config,"Database pool size increased to 100"
  2025-01-14T16:00:00Z,feature,"New payment provider integration"

task: |
  Analyze the incident and provide:
  1. Root cause analysis based on logs and metrics
  2. Immediate mitigation steps to restore service
  3. Correlation between recent changes and the incident
  4. Long-term fixes to prevent recurrence
  5. Postmortem recommendations

DevOps Token Efficiency:

Log analysis often requires hundreds of log entries for accurate diagnosis. TOON's structured arrays let DevOps teams include 2-3x more log entries in LLM prompts, leading to better root cause identification and faster incident resolution.

Token Savings Across Use Cases

Use CaseJSON TokensTOON TokensSavings
Customer Churn Analysis~420~21050%
E-commerce Orders~340~17050%
Fraud Detection~520~26050%
RAG Document Retrieval~280~14050%
Healthcare Records~390~19550%
Sales Pipeline~480~24050%
Chatbot Conversation~360~18050%
Log Analysis~440~22050%

* Token counts measured using GPT-4 tokenizer. Actual savings may vary slightly based on data content.

Try These Examples Yourself

Related Resources

External Resources