Skip to content

Dotted Keys Explained

In CCL, dotted keys are literal string keys containing dots, not shorthand for nested structures.

These create different data structures:

# Dotted key (literal string)
database.host = localhost
→ Entry("database.host", "localhost")
# Hierarchical nesting
database =
host = localhost
→ Entry("database", "host = localhost")
→ After build_hierarchy(): {database: {host: "localhost"}}

Dotted keys use the literal string:

get_string(config, "database.host") // ✓ Works
get_string(config, "database", "host") // ❌ No nested object

Hierarchical data uses nested access:

get_string(config, "database", "host") // ✓ Works
get_string(config, "database.host") // ❌ No literal key
# ✓ Hierarchical (recommended)
database =
host = localhost
port = 5432
# ✓ Dotted keys
database.host = localhost
database.port = 5432
# ❌ Don't mix - creates separate keys
database =
host = localhost
database.port = 5432 # Different key!

Some implementations provide dotted representation - allowing dotted access to hierarchical data. This is experimental and optional. Check your implementation’s documentation.