Skip to content

TypeflowTyped JSON transformations

A declarative mapping language for JSON — validated paths, inferred output types, and compile-time errors instead of production incidents.

Typeflow

Try it — this page runs the real compiler ​

Everything below is live: edit the mapping or the input and watch the output, the inferred type, and the diagnostics update on every keystroke. No server — the compiler and the runtime are running in your browser.

Mapping✔Playground ↗
Input JSON
Output
{
  "id": 42,
  "fullName": "Ada Lovelace",
  "isAdmin": true,
  "email": "unknown",
  "activeTags": [
    "founder"
  ],
  "results": [
    {
      "value": 16,
      "grade": "A"
    },
    {
      "value": 9,
      "grade": "C"
    },
    {
      "value": 12,
      "grade": "B"
    }
  ]
}
inferred type{ id: number; fullName: string; isAdmin: boolean; email: string; activeTags: string[]; results: { value: number; grade: "A" | "B" | "C" }[]; }

Typos are compile errors, not production incidents ​

This mapping has two classic bugs: a misspelled property and an unguarded optional access. In a plain function they'd ship as silent undefineds — here they never leave your editor. Fix them live: emial → email, and add ?. + ?? on the second line.

Mapping✖ 2Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred type{ mail: any; phone: string }
  • 7:14errorTF2002Property 'emial' does not exist on type '{ email: string; contact?: { phone: string } }'. Did you mean 'email'?
  • 8:23errorTF2003Object is possibly 'undefined'.
    hint: Use the optional access operator: '?.phone', or provide a default with '??'.

Every diagnostic has a stable code, a hint, and a live reproduction in the diagnostics reference.

The whole language is documented from source ​

Operator pages, the function reference, and the diagnostics reference are generated from the same definitions the compiler executes — signatures, docs and examples can't drift from the implementation. The build fails if an example stops compiling.

51
builtin functions
typed, documented, live
30
operators & constructs
each with a playground
21
diagnostics
documented with live repros
0
runtime dependencies
Node, Bun, browsers, CI

Why not JSONata, jq, or a plain function? ​

TypeflowJSONatajqZodPlain TS function
Declarative transformation✅✅✅❌ (validation)❌
Input paths statically validated✅❌❌n/a✅
Output type inferred✅❌❌⚠️ declared✅
Serializable / sandboxable artifact✅✅✅❌❌
Deterministic by design✅⚠️✅n/a❌

Zod is a natural input to Typeflow, not a competitor: Zod answers "is this X?"; Typeflow answers "how does X become Y, and is that conversion sound?"

Get started in a minute ​

console
$ bun add -d typeflowjs
$ bunx typeflow init                 # scaffold an example mapping
$ bunx typeflow check                # tsc-style diagnostics
$ bunx typeflow run user.typeflow --input data.json

Released under the MIT License.