Because KSON does not use significant whitespace (unlike YAML), plain structures (Plain Dash Lists and Plain Objects) rely on greedy parsing.
- Plain Dash Lists absorb every
- element they can, ending at the first non-dash element or an explicit end-dash =. - Plain Objects absorb every
key: value property they can, ending at the first non-property element or an explicit end-dot ..
When to use terminators:
You only need a terminator (= for lists, . for objects) when the greedy parser would otherwise incorrectly absorb an element/property that belongs to a parent structure. If a structure ends naturally (e.g., a list ends because the next line is a new key), no terminator is required.
Explicitly using terminators is always legal; the KSON formatter will remove them if they are unnecessary.
# Natural end: the list ends because 'lucky_color' is a key, not a list element
lucky_numbers:
- 7
- 13
lucky_color: blue
# Required end-dot: without '.', 'favorite_movie' would be absorbed into the book object
favorite_books:
- title: Elements
author: Euclid
- title: Metaphysics
author: Aristotle
.
favorite_movie: 'The Rock'