Parse & Transform
Parse structured data, encode/decode formats, extract values from objects and text, and convert between representations.
| Verb | Description |
|---|---|
PARSE JSON "str" | Parse JSON string into an object or array |
PARSE CSV "str" | Parse CSV into array of row objects |
PARSE XML "str" | Parse XML into an object |
PARSE YAML "str" | Parse YAML into an object |
PARSE HTML "str" | Parse HTML — returns DOM-like structure |
PARSE MARKDOWN "str" | Convert Markdown to HTML string |
PARSE TOML "str" | Parse TOML config into an object |
ENCODE "text" AS "format" | Encode: base64, url, hex, html |
DECODE "text" AS "format" | Decode: base64, url, hex, html |
EXTRACT "text" WHERE "pattern" | From text: regex first match. From object: JSONPath lookup. From array: field from each element. |
EXTRACT "text" WHERE "pattern" AS "all" | Regex — returns all matches as array |
CAST ?val AS "type" | Type conversion — see Compute |
PLUCK ?array WHERE "field" | Extract one named field from every object in an array |
PARSE JSON
PARSE JSON `{"name":"Alice","age":30}` SET ?obj
AFTER EMIT ?obj(name) & " is " & ?obj(age)
Try it ›
PARSE CSV
PARSE CSV "name,age\nAlice,30\nBob,25" SET ?rows
AFTER EMIT ?rows(0)(name)
Try it ›
ENCODE / DECODE
ENCODE "Engineering Magic" AS "base64" SET ?b64
AFTER DECODE ?b64 AS "base64" SET ?back
AFTER EMIT ?b64 & " => " & ?back
Try it ›
ENCODE "hello world & more" AS "url" SET ?e
AFTER EMIT ?e
EXTRACT — regex, JSONPath, and array field extraction
EXTRACT adapts to what you give it: regex on text, key lookup on objects, field extraction across arrays.
(* From text — regex first match *)
EXTRACT "My email is alice@example.com here" WHERE "[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}" SET ?email
AFTER EMIT ?email
Try it ›
(* From text — all regex matches *)
EXTRACT "prices: $10 $25 $99" WHERE "\$[0-9]+" AS "all" SET ?prices
AFTER EMIT ?prices
(* From object — key lookup *)
PARSE JSON `{"user":{"email":"alice@example.com"}}` SET ?obj
AFTER EXTRACT ?obj WHERE "user.email" SET ?email
AFTER EMIT ?email
(* From array — extract field from every element *)
PARSE JSON `[{"name":"Alice"},{"name":"Bob"}]` SET ?users
AFTER EXTRACT ?users WHERE "*.name" SET ?names
AFTER EMIT ?names
PLUCK
Extract one named field from every object in an array — shorthand for the common "get all names" pattern.
PARSE JSON `[{"name":"Alice","age":30},{"name":"Bob","age":25}]` SET ?users
AFTER PLUCK ?users WHERE "name" SET ?names
AFTER EMIT ?names
Try it ›