Transform Reference

Type Coercion & Encoding Verbs

Type conversion (string, number, boolean, date), Base64 encoding, URL encoding, and hashing.

Type Coercion

VerbSyntaxDescriptionTry It
coerceString%coerceString @pathConvert to string Try
coerceNumber%coerceNumber @pathConvert to number Try
coerceInteger%coerceInteger @pathConvert to integer Try
coerceBoolean%coerceBoolean @pathConvert to boolean Try
coerceDate%coerceDate @pathConvert to date Try
tryCoerce%tryCoerce @pathAuto-detect and convert type Try

Encoding & Hashing

VerbSyntaxDescriptionTry It
base64Encode%base64Encode @pathEncode to Base64 Try
base64Decode%base64Decode @pathDecode from Base64 Try
urlEncode%urlEncode @pathURL-encode string Try
sha256%sha256 @pathSHA-256 hash Try
md5%md5 @pathMD5 hash Try
base64urlEncode%base64urlEncode @pathURL-safe Base64, no padding Try
base64urlDecode%base64urlDecode @pathDecode URL-safe Base64 Try
hmac%hmac @message "key" ["alg"]Keyed hash, hex output (default sha256) Try
parseUrl%parseUrl @urlSplit a URL into parts (query keys sorted) Try
buildUrl%buildUrl @partsInverse of parseUrl (query keys sorted) Try
parseQuery%parseQuery @qsParse a query string into an object (keys sorted) Try
buildQuery%buildQuery @objectSerialize an object to a query string (keys sorted) Try
stableStringify%stableStringify @valueCanonical JSON with object keys sorted recursively Try
canonicalHash%canonicalHash @valueSHA-256 of the canonical form (order-independent) Try

Examples

Type coercion examples
; Type conversion
year_str = %coerceString @vehicle.year               ; 2024 -> "2024"
amount = %coerceNumber @premium_text                 ; "1234.50" -> 1234.50
active = %coerceBoolean @is_active                   ; "true" -> true

; Encoding
encoded = %base64Encode @document.content            ; Binary -> Base64
url = %urlEncode @search.query                       ; Spaces -> %20