First Steps with Branchline¶
New to Branchline? This walkthrough takes you from zero to running code and inspecting traces.
1) Open the playground¶
- Visit the embedded playground.
- Load
customer-profileorcollection-transforms. - Toggle tracing and run with Cmd/Ctrl + Enter.
- Paste your own JSON (or XML) in the input pane and rerun.
2) Learn the essentials¶
- Paths:
$/INPUTrefers to the root payload. Usemsg.field,items[0], slices[start:end], predicates[expr], and wildcards.*. - Bindings:
LET name = expr;defines variables. Use??to coalesce nulls. - Control flow:
IF/ELSE,FORorFOR EACH, comprehensions[FOR (x IN xs) => expr],TRY/CATCHfor safe handling. - Output: shape your result with
OUTPUT { ... }. - Tracing:
EXPLAIN("var"),CHECKPOINT("label"),ASSERT(condition, "msg").
3) Run locally (JVM)¶
Use--input-format xml for XML payloads.
4) Explore the standard library interactively¶
- Open any stdlib example in the playground via URL, e.g.
?example=stdlib-hof-overviewor?example=stdlib-strings-text. - Edit the inputs to see how functions behave with nulls, empty arrays, and regex patterns.
5) Inspect provenance¶
- Enable tracing, run
stdlib-debug-explain, and observeEXPLAIN("total"). - Add
CHECKPOINTmarkers around expensive sections to see progress.
6) Keep learning¶
- Read the Language Overview for syntax details and semantics.
- Use the Install guide when you want to run Branchline offline.
- Browse the stdlib pages for per-function behavior and gotchas, each linked to an interactive example.