In this Page
...
Description | Create a new object that retains some properties from the original as specified by the given callback. | ||
---|---|---|---|
Syntax |
| ||
Example | Expression: $.filter((value, key) => key.startsWith("new")) ResultInput:
|
...
Returns an array Result: | Description |
|
---|
keys
Description | Returns an array of strings that represent all the enumerable properties of the given object. The ordering of the properties is the same as that given by looping over the properties of the object manually. See also values, entries. | ||
---|---|---|---|
Syntax |
| ||
Example | Input:
Expression: $user.keys() |
...
Description | Transform the names of properties in an object using a callback. This is similar to https://lodash.com/docs/4.17.4#mapKeys | ||
---|---|---|---|
Syntax |
| ||
Example | Expression: ResultInput:
|
...
Transform the Result: | Description |
|
---|
mapValues
Description | Transform the values of properties in an object using a callback. This is similar to https://lodash.com/docs/4.17.4#mapValues | ||||
---|---|---|---|---|---|
Syntax |
| ||||
Example | Expression: Input:
Result:
|
...
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.
|