Skip to content

Literals & objects ​

The leaves of a map block are expressions. The simplest expressions are literals — fixed values copied to the output as-is. Every example on this page is live: edit the mapping or the input and the output recomputes instantly.

OperatorEffect
"…" 0 true nullscalar literals: string, number, boolean, null
[ ] { }array and object literals
nested { }a field's value can itself be an object of fields

"…" 0 true null : scalar literals: string, number, boolean, null ​

Strings use double quotes; numbers, booleans, and null look like JSON.

typeflow
schema: "order/v2"
revision: 7
ratio: 0.5
active: true
legacyId: null

[ ] { } : array and object literals ​

Literal arrays and objects can mix fixed values and expressions over the input.

typeflow
tags: ["export", "v2"]
flags: [true, false]
meta: { source: "api", author: user.name }

nested { } : a field's value can itself be an object of fields ​

The shape of the map block mirrors the shape of the output.

typeflow
user: {
  id: user.id,
  profile: {
    displayName: user.name,
    version: 1,
  },
}

Playground ​

Mapping✔Playground ↗
Input JSON
Output
{
  "schema": "order/v2",
  "revision": 7,
  "ratio": 0.5,
  "active": true,
  "legacyId": null,
  "id": 128
}
inferred type{ schema: "order/v2"; revision: 7; ratio: 0.5; active: true; legacyId: null; id: number; }

Next: Paths & optionality — reading values out of the input.

Released under the MIT License.