Back to AXON

Encoding Modes

AXON automatically selects the optimal encoding mode based on your data structure

COMPACT

Compact Mode

Default for uniform arrays

CSV-like columnar format with type annotations. Best for arrays of similar objects.

NESTED

Nested Mode

For complex hierarchies

Handles objects with arbitrary nesting depth while maintaining compression benefits.

COLUMNAR

Columnar Mode

For large datasets (1000+ rows)

Column-oriented storage optimized for analytics and large tables.

STREAM

Stream Mode

For time-series data

Optimized for sequential data with temporal ordering. Applies delta encoding automatically.

SPARSE

Sparse Mode

For data with >50% nulls

Only stores non-null values with position indices, dramatically reducing size.

JSON

JSON Fallback

For irregular data

Falls back to JSON for highly irregular data where compression wouldn't help.

Mode Selection Example

You can check which mode AXON would recommend for your data:

import { getModeRecommendation } from '@axon-format/core';

const data = { /* your data */ };
const recommendation = getModeRecommendation(data);

console.log(recommendation.mode);   // 'columnar'
console.log(recommendation.reason); // Explanatory text

Best Practice: Let AXON choose the mode automatically. Manual override is rarely needed and may reduce compression effectiveness.