Expressions
Forge Json includes a built-in expression engine that lets you write dynamic formulas using the {{expression}} syntax. Expressions are used across multiple features to transform, filter, and compute values.
Where expressions are used
| Feature | What expressions do | Example |
|---|---|---|
| Find & Replace | Dynamic replacement values using the old variable | {{old.toUpperCase()}} |
| Tabular Operations | Filter rows, compute new columns, conditional updates | {{age >= 18}} |
| Generate CSV | Map JSON fields to CSV columns | {{stringify(address)}} |
| Compute Fields | Create derived fields from existing data | {{price}} * {{quantity}} |
Quick examples
String transformation (Find & Replace)
Search: hello
Replace: {{old.toUpperCase()}}
Result: HELLORow filtering (Tabular Operations)
Condition: {{age >= 18}}Given [{"name": "Alice", "age": 25}, {"name": "Bob", "age": 12}], this keeps only Aliceβs row.
Computed field
Expression: {{firstName}} {{lastName}}
Target: fullNameGiven {"firstName": "Jane", "lastName": "Doe"}, produces {"firstName": "Jane", "lastName": "Doe", "fullName": "Jane Doe"}.
Math
Expression: {{price * quantity}}Given {"price": 10, "quantity": 5}, returns 50.
How it works
The expression engine uses JSEPΒ (JavaScript Expression Parser) to parse expressions into an abstract syntax tree (AST), then evaluates them safely β no eval() is ever used.
Expressions are read-only β they can access and compute values but cannot modify the original data. Transformations are always applied as new values.
Security
The expression engine enforces strict safety rules:
- AST-based evaluation β no
eval()ornew Function() - Maximum recursion depth of 20 levels
- Forbidden property access β
__proto__,prototype, andconstructorare blocked - No computed property access β
obj[key]syntax is not allowed; use dot notation instead - Whitelisted functions only β only approved Math, Date, and utility functions are available
Next steps
- Template Syntax β how
{{...}}templates work - Operators β arithmetic, comparison, and logical operators
- Built-in Functions β Math, Date, and utility functions
- String Methods β methods available on the
oldvariable - Field Access β how to reference fields in your data
- Usage Contexts β how expressions differ across features