Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fixed the TOC

...

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.

Note

This function is not supported in Spark pipelines.

See also: Checking for optional properties and returning defaults in the expression language

Syntax


object.get(field, [defaultValue])


Example

Expression$.get("Id")

Result: Returns the value of the "Id" property or null if the object does not have the property.


Expression$.get("Id", 123)

Result: Returns the value of the "Id" property or the number "123" if the object does not have the property.

...

DescriptionCreate a new object that retains some properties from the original as specified by the given callback.
Syntax


Code Block
object.filter(callback)
  • callback - A function that takes three arguments (property-value, property-name, input-object) and returns true if the property should be included in the returned object or false if it should be left out.
Example

Expression: $.filter((value, key) => key.startsWith("new"))

Input:

Code Block
{
      "key1": "abc",
      "key2": "xyz",
	  "newField1": "foo",
      "newField2": "bar"
    }

Result:

Code Block
{
      "newField1": "foo",
      "newField2": "bar"
    }


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


Code Block
property.keys()


Example

Input:

Code Block
let user = {
	name: "John",
	age: 30
}

Expression: $user.keys()
Result: [name, age]

...