Typed expansion

By default, expansion always produces a string. A type directive converts the result to a specific type — necessary when a configuration property requires a non-string value such as a number, boolean, or JSON object.

Syntax

@<type>:<value>

The value can be a literal or an expression:

@int:99
@boolean:${config.debug}
@json:${data.object}

Supported types

Directive
Result

@string

String (default, same as no directive)

@int

Integer

@long

Large integer

@float

Decimal number

@double

Double-precision decimal

@number

Number — automatically selects integer or decimal type based on value

@bool

Boolean

@boolean

Boolean

@json

JSON object or array

@json-object

JSON object

@json-array

JSON array

Behavior

No directive — value is treated as a string, including any ${...} expressions:

Unknown directive — if the directive is not recognised, the entire value is treated as a plain string without error:

Invalid conversion — if the value cannot be converted to the specified type (e.g. @int:hello), an error is raised. For booleans, only true (case-insensitive) is true — all other values are false.

JSON — the value must be valid JSON. An invalid JSON string raises an error. Use @json: when the result may be either an object or an array; use @json-object: or @json-array: when the type is known.

Last updated