Format Comparison Tool

Compare token usage across JSON, TOON, YAML, and CSV formats

Input JSON Data
Paste your JSON to compare formats
Automate Format Comparison
Use our package to compare formats programmatically

1. Install the package

npm install @toonparse/core

2. Use in your code

import { compareFormats } from '@toonparse/core';

const data = {
  users: [
    { id: 1, name: 'Alice', role: 'admin' },
    { id: 2, name: 'Bob', role: 'user' }
  ]
};

const comparison = compareFormats(data);

console.log(`JSON: ${comparison.jsonTokens} tokens`);
console.log(`TOON: ${comparison.toonTokens} tokens`);
console.log(`Savings: ${comparison.savingsPercent}%`);
// Output:
// JSON: 50 tokens
// TOON: 20 tokens
// Savings: 60%

💡 The @toonparse/core package includes token counting, format comparison, and eligibility checking utilities.

Understanding the Comparison

This tool helps you understand which format is most efficient for your specific data:

  • TOON - Best for uniform arrays, 30-60% savings over JSON
  • CSV - Most compact for pure tabular data, but limited functionality
  • YAML - Good balance of readability and compactness
  • JSON - Universal standard, but verbose for LLM prompts