# Variable Filters & Substitution Modes

Source: https://www.jawsdeploy.net/features/variable-filters-and-modes

Extended variable syntax adds transformations and conditional rendering. Workspace modes let existing deployments adopt it deliberately, without changing output on upgrade.

Transform a variable directly inside its `#{...}` reference instead of adding one-off scripting around it. Project variables use `VAR.` and built-in deployment values use `CONTEXT.`; the unprefixed project-variable shorthand is available only during package file replacement. Convert case, trim text, replace patterns, format numbers and dates, encode values, escape configuration formats, and feed comparisons into conditional blocks.

## Filter, chain, and render conditionally

Filters run from left to right, after nested variable references are resolved. Use `VAR.` for project variables and `CONTEXT.` for built-in deployment values.

```
#{VAR.SiteName | Trim | ToLower}
#{VAR.ConnectionJson | JsonEscape}

#{if CONTEXT.EnvironmentName == "Production"}
logging.level=Warning
#{else}
logging.level=Debug
#{/if}
```

## Safe controls around more expressive templates

- **18 built-in filters**: Case conversion, text manipulation, formatting, encoding, escaping, matching, and comparisons.
- **Conditional blocks**: Use `if`, `unless`, and `else`, including nesting and filtered conditions.
- **Compatibility modes**: Existing workspaces stay on Legacy; new workspaces default to Extended unless you choose otherwise.
- **Unresolved-token policy**: Leave missing tokens silent, warn in deployment logs, or fail before the step runs.

> **// Upgrade safely - Audit first, then opt in.**
> 
> Existing workspaces are pinned to **Legacy**, so upgrading changes neither rendered output nor deployment logs. Switch unresolved tokens to **Warn**, clear genuine mistakes or escape literal text as `##{...}`, update agents that replace variables inside package files, then enable **Extended**. Move to **Strict** only when warnings are clean.

The [Variable Filters & Substitution Modes guide](https://www.jawsdeploy.net/guides/variable-filters-and-modes) documents every filter, conditional rule, error case, compatibility guarantee, and rollout step.

