Quickstart
The simplest way to use Datadance is with the transform function.
Basic example
When you call transform, you provide your data (input), the operations to perform (transforms), and how to merge the result (settings).
- Input
- Output
- Transforms (JSON)
- Transforms (DDS)
{
"name": "Alice",
"score": 85
}
{
"name": "ALICE",
"score": 100,
"grade": "B"
}
[
{ "name": "upper(input.name)" },
{ "score": "input.score + 15" },
{ "grade": "input.score >= 90 ? 'A' : 'B'" }
]
name: upper(input.name)
score: input.score + 15
grade: input.score >= 90 ? 'A' : 'B'
Transform structure
Each transform is an object with exactly one key. The key is the output field name, and the value is either a MozJexl expression string or an array of nested transforms.
Merge methods
The merge_method setting controls how the output is combined with the input:
| Method | Behaviour |
|---|---|
overwrite | Transformed fields replace matching input keys. Unchanged input fields are preserved. |
preserve | Original input is returned as-is. Transformed fields are nested under a transforms key. |
transforms_only | Only transformed fields are returned. All input data is discarded. |
Using DDS syntax
Instead of JSON, you can write transforms in Datadance Syntax (DDS), a YAML-like format:
- DDS
- JavaScript
name: upper(input.name)
score: input.score + 15
const result = await transform({
input: { name: "Alice", score: 85 },
transforms: "name: upper(input.name)\nscore: input.score + 15",
settings: { merge_method: "overwrite", transforms_syntax: "dds" },
});
Interactive Playground
Try it live in the Playground — edit input, write transforms, and see results instantly.