{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"redocly_category":"Journeys","product":"Identity Management","type":"markdown"},"seo":{"title":"Expressions: Constructors","description":"Everything about Mosaic Journeys, SDKs, and APIs","siteUrl":"https://developer.transmitsecurity.com/","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"expressions-constructors","__idx":0},"children":["Expressions: Constructors"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Constructors create complex values from expressions and structuring information. Constructors can be used to create strings based on templates and values (interpolated strings), objects based on keys and values, and arrays."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"interpolated-strings","__idx":1},"children":["Interpolated strings"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Interpolated string constructors create values of type ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}," by embedding the results of expressions within a containing string. Interpolated strings are denoted by backticks (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["`"]},")."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For example, the interpolated string ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["`One plus one is ${1+1}`"]}," will compute the value of the expression ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1+1"]},", and embed the result in the containing string to yield ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["One plus one is 2"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Within intepolated strings, the following elements may appear:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Syntax"},"children":["Syntax"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Example"},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["${expression}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Expression to include in the string. It will be replaced by the expression's result coerced to a string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["`Hello, ${user}`"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\\`"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Backtick"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["`\\``"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\\$"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Dollar-sign"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["`\\$500`"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\\\\"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Backslash"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["`here is a backslash: \\\\`"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Other characters"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Include character in resulting string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["`this is a simple string`"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"object-constructors","__idx":2},"children":["Object constructors"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Object constructors are used to create values of type ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["object"]},". They consist of a sequence of key-value pairs. Their syntax is similar to the JavaScript syntax for objects. For example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"{\n   \"key1\" : value1,\n   key2 : value2,\n   ...\n}\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Objects may be empty (i.e., not contain any key-value pairs). Keys can be denoted as string literals, or valid identifiers (i.e., begin with a letter and consist only of letters and numbers). Values may be any expression."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To avoid ambiguity and errors, it is recommended to always put keys as string literals with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"\""]},". In the example above, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["key1"]}," is explicitly denoted as string literal while for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["key2"]}," if such a variable exists, its value will be used; otherwise it will be coerced to a string literal as well."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example demonstrates the different notations for keys in an object:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"{\n   identifierKey : 3,\n   \"key with illegal identifier characters\": 4\n}\n","lang":"js"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"array-constructors","__idx":3},"children":["Array constructors"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Array constructors are used to create values of type ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["array"]},". They consist of a sequence of values, but may also be empty. Their syntax is similar to the JavaScript syntax for arrays:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"[ value1,  value2, ... ]\n","lang":"js"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"lambda-constructors","__idx":4},"children":["Lambda constructors"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To construct a value of type ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["lambda"]},", use the following syntax:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"(param1, param2, ...) => body\n","lang":"js"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["where ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["param1"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["param2"]},",... is a set of comma-delimited valid identifiers for arguments, and body is any expression. The body expression may refer to all variables defined in the scope of the lambda construction as well as the arguments. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/orchestration/getting-started/expressions/lamda"},"children":["Lambda Invocations"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"compose-constructors","__idx":5},"children":["Compose constructors"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Since constructors use expressions to denote values, constructs can be nested and composed to create complex structures. For example, one can create an object with an interpolated string and an array as two attributes using the following expression:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"{\n   interpolatedString: `1 plus 1 are ${1+1}`,\n   array: [ 2, 3, 1+2 ]\n}\n","lang":"js"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Note"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A lambda value cannot be contained within arrays and objects."]}]},{"$$mdtype":"Tag","name":"style","attributes":{},"children":["\ntable th:nth-child(1){min-width: 150px}\ntable th:nth-child(3){min-width: 250px}\n"]}]},"headings":[{"value":"Expressions: Constructors","id":"expressions-constructors","depth":1},{"value":"Interpolated strings","id":"interpolated-strings","depth":2},{"value":"Object constructors","id":"object-constructors","depth":2},{"value":"Array constructors","id":"array-constructors","depth":2},{"value":"Lambda constructors","id":"lambda-constructors","depth":2},{"value":"Compose constructors","id":"compose-constructors","depth":2}],"frontmatter":{"showNextButton":true,"showPrevButton":true,"seo":{"title":"Expressions: Constructors"}},"lastModified":"2025-11-18T16:48:04.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/orchestration/getting-started/expressions/constructors","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}