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'
TOON format (default) - a concise, human-readable format
json
'json'
Pretty-printed JSON with 2-space indentation
yaml
'yaml'
YAML format
md
'md'
Markdown format with tables for structured data
jsonl
'jsonl'
JSON Lines format (one JSON object per line)

Functions

format

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

Usage: Basic Formatting

Usage: Markdown Tables

Usage: Scalar Values

Usage: CLI Output

Usage: Nested Objects