You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- 📐 **Indentation-based structure:** like YAML, uses whitespace instead of braces
82
82
- 🧺 **Tabular arrays:** declare keys once, stream data as rows
83
+
- 🔗 **Optional key folding (v1.5):** collapses single-key wrapper chains into dotted paths (e.g., `data.metadata.items`) to reduce indentation and tokens
83
84
84
85
[^1]: For flat tabular data, CSV is more compact. TOON adds minimal overhead to provide explicit structure and validation that improves LLM reliability.
See §13.4 in the [specification](https://github.com/toon-format/spec/blob/main/SPEC.md#134-key-folding-and-path-expansion) for folding rules and safety guarantees.
840
+
800
841
### Arrays
801
842
802
843
> [!TIP]
@@ -975,6 +1016,8 @@ Converts any JSON-serializable value to TOON format.
975
1016
-`indent?: number` – Number of spaces per indentation level (default: `2`)
976
1017
-`delimiter?: ',' | '\t' | '|'` – Delimiter for array values and tabular rows (default: `','`)
-`keyFolding?: 'off' | 'safe'` – Enable key folding to collapse single-key wrapper chains into dotted paths (default: `'off'`). When `'safe'`, only valid identifier segments are folded (v1.5)
1020
+
-`flattenDepth?: number` – Maximum number of segments to fold when `keyFolding` is enabled (default: `Infinity`). Values 0-1 have no practical effect (v1.5)
978
1021
979
1022
**Returns:**
980
1023
@@ -1096,6 +1139,7 @@ Converts a TOON-formatted string back to JavaScript values.
1096
1139
-`options` – Optional decoding options:
1097
1140
-`indent?: number` – Expected number of spaces per indentation level (default: `2`)
-`expandPaths?: 'off' | 'safe'` – Enable path expansion to reconstruct dotted keys into nested objects (default: `'off'`). Pairs with `keyFolding: 'safe'` for lossless round-trips (v1.5)
1099
1143
1100
1144
**Returns:**
1101
1145
@@ -1223,7 +1267,7 @@ Task: Return only users with role "user" as TOON. Use the same header. Set [N] t
1223
1267
## Other Implementations
1224
1268
1225
1269
> [!NOTE]
1226
-
> When implementing TOON in other languages, please follow the [specification](https://github.com/toon-format/spec/blob/main/SPEC.md) (currently v1.4) to ensure compatibility across implementations. The [conformance tests](https://github.com/toon-format/spec/tree/main/tests) provide language-agnostic test fixtures that validate implementations across any language.
1270
+
> When implementing TOON in other languages, please follow the [specification](https://github.com/toon-format/spec/blob/main/SPEC.md) (currently v1.5) to ensure compatibility across implementations. The [conformance tests](https://github.com/toon-format/spec/tree/main/tests) provide language-agnostic test fixtures that validate your implementations.
0 commit comments