Documentation Index
Fetch the complete documentation index at: https://mintlify.com/toon-format/toon/llms.txt
Use this file to discover all available pages before exploring further.
Function Signature
Parameters
Iterable of TOON lines (without newlines). Can be an array, generator, or any iterable of strings.
Optional decoding configuration.
Number of spaces per indentation level. Must match the indentation used when encoding.
When
true, enforce strict validation of array lengths and tabular row counts.Enable path expansion to reconstruct dotted keys into nested objects. When set to
'safe', keys containing dots are expanded into nested structures if all segments are valid identifiers (e.g., data.metadata.items becomes nested objects). Pairs with keyFolding='safe' for lossless round-trips.Returns
Parsed JavaScript value (object, array, or primitive).
Examples
Use Cases
Pre-split Input
When you already have lines from another source (file streams, network, etc.),decodeFromLines is more efficient than joining and splitting:
Streaming Decode with Full Value
When you want to stream input but need the complete value (with path expansion):Processing Line Arrays
Comparison with decode()
decodeFromLines is essentially equivalent to:
decodeFromLines is more efficient when you already have lines, as it avoids the join and re-split operations.
Related Functions
- decode - Decode from a complete TOON string
- encodeLines - Encode to lines for streaming
