Skip to content

Object Property#

This converter receives an object, it iterates through it using the path input and returns the found value casted in the type specified in the input type. If no value is found, it will use the default value. It can also be configured to fail if the property is not found. If for example, one has a raw event, it will have this kind of object :

image124

If you wanted to access a property of this object, for example $id, you could use the input path as event.$id and input type Integer.

Settings#

Name Data Type Possible Values Description
path String Path to use to find the property on the object
type Enum Boolean
String
Integer
Long
Decimal
Object
Date
Result type of the value to output
defaultValue any Value to return when the property is not found or its value cannot be converted to type
failIfNotFound Boolean Whether the converter should fail if the path is not found in the object

Table 1: Settings

image125

Examples#

Assuming the input object:

{
  "int": 123,
  "string": "hello",
  "bool": true,
  "bool2": false,
  "decimal": 12.34,
  "object": {
    "in_int": 456,
    "in_string": "world",
    "in_object": { "in_in_bool": true }
  }
}
path type defaultValue failIfNotFound Output
int Integer 404 false 123
object.in_int Integer 404 false 456
string Integer 404 false 404 (value is not an integer - defaultValue is returned)
string String 404 false hello
object.in_string String 404 false world
bool Boolean 404 false true
bool2 Boolean 404 false false
decimal Decimal 404 false 12.34
object Object 404 false { in_int, in_string, in_object }
object.in_object Object 404 false { in_in_bool: true }
object.not.existing Object 404 true Fails: path not found in the object.

Table 2: Examples

Failure Behavior#

This converter's behavior on invalid input depends on the failIfNotFound setting:

  • failIfNotFound = false - the converter writes a log entry and returns the configured defaultValue whenever the path cannot be found or the value cannot be converted to type.
  • failIfNotFound = true - the converter fails when a part of the path before the last one is not found, or when the value cannot be converted to type and there is no defaultValue. When only the last part of the path is not found, the converter returns defaultValue without failing, or no value when defaultValue is empty.

See Converters for what happens to the rest of the chain when a converter fails.