Feature Comparison Matrix

Feature DTL JSON CSV XML JWT SAML
Size Efficiency ✓ Excellent ~ Medium ✓ Good ✗ Poor ~ Medium ✗ Very Poor
Schema Validation ✓ Built-in ✗ External ✗ None ~ XSD optional ✗ None ~ XSD
Enum Validation ✓ Native ✗ None ✗ None ~ Via XSD ✗ None ✗ None
Type Safety ✓ Strong ~ Weak ✗ None ~ Via XSD ✗ None ~ Via XSD
Cryptographic Integrity ✓ Built-in ✗ None ✗ None ✗ None ✓ Signature ✓ XML-DSig
Web3 Support ✓ Native ✗ None ✗ None ✗ None ✗ None ✗ None
Human Readable ✓ Yes ✓ Yes ✓ Yes ~ Verbose ✗ Base64 ✗ Very verbose
Streaming Support ✓ Line-based ✗ Parse all ✓ Line-based ✗ DOM needed ✗ Token-based ✗ DOM needed
Multi-table Support ✓ Native ~ Arrays ✗ Single ~ Nested ✗ No ~ Assertions

Size Comparison

The same data represented in different formats:

DTL (186 bytes)

USERS|id:s,name:s,role:e(admin,user)|2|S0|W0|C0
U001|Alice|admin
U002|Bob|user

JSON (298 bytes) - 60% larger

{
  "users": [
    {"id": "U001", "name": "Alice", "role": "admin"},
    {"id": "U002", "name": "Bob", "role": "user"}
  ]
}

CSV (62 bytes) - No schema!

id,name,role
U001,Alice,admin
U002,Bob,user

❌ No type info, no validation

XML (412 bytes) - 120% larger

<users>
  <user>
    <id>U001</id>
    <name>Alice</name>
    <role>admin</role>
  </user>
  <user>...</user>
</users>

DTL vs JWT for Authentication

❌ JWT Problems

  • alg=none vulnerability - Algorithm can be set to "none"
  • Algorithm confusion - RS256 vs HS256 attacks
  • No schema - Claims are unvalidated strings
  • Base64 bloat - 33% larger than raw
  • No enum constraints - Roles can be any string
  • No Web3 - No wallet binding support

✅ DTLAuth Solutions

  • Single algorithm - BLAKE3 + Ed25519 only
  • No confusion possible - Deterministic format
  • Schema-enforced - All claims are typed
  • Ultra-compact - 40-60% smaller
  • Enum validation - role:e(admin,user,guest)
  • Web3 native - Wallet-bound tokens

Token Size Comparison

Token Type JWT Size DTLAuth Size Savings
Simple ID Token ~450 bytes ~180 bytes 60%
Access Token with Scopes ~600 bytes ~250 bytes 58%
Full Auth Bundle ~1200 bytes ~450 bytes 62%

DTL vs SAML

SAML is verbose XML-based and designed for enterprise federation. DTLAuth provides similar capabilities in a fraction of the size.

Aspect DTLAuth SAML 2.0
Typical Token Size 200-500 bytes 2000-5000 bytes
Parsing Complexity Simple line parsing Full XML DOM
Schema Validation Built-in with enums Requires XSD
Mobile Friendly Yes - compact No - too verbose
Web3 Ready Native support Not designed for it

When to Use DTL

✅ Use DTL When

  • Bandwidth is constrained (IoT, mobile, satellite)
  • You need schema validation
  • Enum constraints are important
  • Cryptographic integrity is required
  • Web3/blockchain integration needed
  • Healthcare, finance, or compliance
  • Replacing JWT/SAML tokens

📝 Consider Alternatives When

  • Deep nesting is required (use JSON)
  • Existing JSON APIs are entrenched
  • Rich document markup needed (use XML)
  • Simple flat data export (CSV might suffice)
  • Legacy system compatibility required

SDK Format Conversion Examples

Easy conversion between DTL and other formats:

🐍 Python - DTL ↔ JSON ↔ CSV

from dtl_parser import DTLParser, create_table
import json, csv

parser = DTLParser()

# ── DTL → JSON ──
doc = parser.parse_file("data.dtl")
users = doc.get_table("USERS")

json_data = users.to_json()
with open("data.json", "w") as f:
    json.dump(json_data, f, indent=2)

# ── DTL → CSV ──
csv_data = users.to_csv()
with open("data.csv", "w") as f:
    f.write(csv_data)

# ── JSON → DTL ──
with open("input.json") as f:
    json_input = json.load(f)

table = create_table("USERS", {
    "id": "s",
    "name": "s",
    "role": "e(admin,user,guest)",  # Add enum validation!
})

for item in json_input:
    table.add_row(item)

dtl_output = table.to_dtl()
print(dtl_output)

📘 TypeScript - DTL ↔ JSON ↔ CSV

import { 
    parse, createTable, tableToDtl, 
    tableToJson, tableToCsv 
} from 'dtl-parser';
import fs from 'fs';

// ── DTL → JSON ──
const doc = parse(fs.readFileSync('data.dtl', 'utf-8'));
const users = doc.tables.find(t => t.name === 'USERS')!;

const jsonData = tableToJson(users);
fs.writeFileSync('data.json', JSON.stringify(jsonData, null, 2));

// ── DTL → CSV ──
const csvData = tableToCsv(users);
fs.writeFileSync('data.csv', csvData);

// ── JSON → DTL with enum validation ──
const jsonInput = JSON.parse(fs.readFileSync('input.json', 'utf-8'));

const table = createTable('PRODUCTS', {
    sku: 's',
    name: 's',
    category: 'e(electronics,clothing,home)',  // Enum!
    price: 'f',
});

jsonInput.forEach((item: any) => table.rows.push(item));

const dtlOutput = tableToDtl(table);
console.log(dtlOutput);

💜 C# - DTL ↔ JSON ↔ CSV

using Dtlaz.Parser;
using System.Text.Json;

var parser = new DtlParser();

// ── DTL → JSON ──
var doc = parser.ParseFile("data.dtl");
var users = doc.GetTable("USERS");

var jsonData = users.ToJson();
File.WriteAllText("data.json", 
    JsonSerializer.Serialize(jsonData, new JsonSerializerOptions { WriteIndented = true }));

// ── DTL → CSV ──
var csvData = users.ToCsv();
File.WriteAllText("data.csv", csvData);

// ── JSON → DTL with enum validation ──
var jsonInput = JsonSerializer.Deserialize<List<Dictionary<string, object>>>(
    File.ReadAllText("input.json"));

var table = DtlFactory.CreateTable("ORDERS", new Dictionary<string, string>
{
    { "id", "s" },
    { "status", "e(pending,shipped,delivered)" },  // Enum!
    { "total", "f" },
});

foreach (var item in jsonInput)
{
    table.AddRow(new Dictionary<string, object?>(item));
}

var dtlOutput = table.ToDtl();
Console.WriteLine(dtlOutput);
💡 Why Convert to DTL?

When you convert JSON/CSV to DTL, you gain enum validation, type safety, and autofix capabilities that don't exist in the original formats!