In this Page
...
Description | Get the value of a property or a default value if the object does not have the given property. If no default value is given, null is returned.
See also: Checking for optional properties and returning defaults in the expression language | ||
---|---|---|---|
Syntax |
| ||
Example | Expression: Result: Returns the value of the "Id" property or null if the object does not have the property. Expression: Result: Returns the value of the "Id" property or the number "123" if the object does not have the property. |
...
Description | Indicates whether the object has the specified property. The in operator and get method can be used as a shorthand to test if an object has a property or get the value of a property with a default if it does not exist.
| ||||
---|---|---|---|---|---|
Syntax |
| ||||
Example | Expression: Result: Returns true if the object has the key "Id" Expression: To create a ternary conditional expression:
|
...
Expand | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||
A JSON Array of objects with unique/non-overlapping keys can be converted to an object using the extend object method along with a Spread Operator. The extend object method does so by creating objects dynamically from other objects passed in as arguments, the spread operator will have to be used to indicate that the elements of the array should be treated as the arguments to the function. The expression to be used is:
1. Input the array into Mapper Snap (this can be done using a JSON Generator Snap). For this example, the following array will be used:
2. The Mapper Snap must be configured as shown below. Notice the Expression and Target path fields.3. When executed, the output will be an object.
|