Skip to main content
The Formatter module provides utilities for serializing data to various output formats. It supports TOON (the default format), JSON, YAML, Markdown tables, and JSONL.

Types

Format

Supported output formats for the format() function.
'toon'
TOON format (default) - a concise, human-readable format
'json'
Pretty-printed JSON with 2-space indentation
'yaml'
YAML format
'md'
Markdown format with tables for structured data
'jsonl'
JSON Lines format (one JSON object per line)

Functions

format

Serializes a value to the specified format. Defaults to TOON.
unknown
required
The value to serialize. Can be any JavaScript value including objects, arrays, primitives, or null/undefined.
Format
default:"'toon'"
The output format. Defaults to 'toon'.
string
The serialized string representation of the value

Usage: Basic Formatting

Usage: Markdown Tables

Usage: Scalar Values

Usage: CLI Output

Usage: Nested Objects