Skip to content

Object Helper

Object Helper allows you to do various operations on objects.

Categories: helpers

Type: objectHelper/v1


Actions

Add Value to the Object by Key

Name: addValueByKey

Add value to the object by key if it exists. Otherwise, update the value

Properties

NameLabelTypeControl TypeDescriptionRequired
sourceSourceOBJECT
Properties {}
OBJECT_BUILDERSource object to be added or updatedtrue
keyKeySTRINGTEXTKey of the value to be added or updated.true
typeTypeSTRING
Options ARRAY, BOOLEAN, DATE, DATE_TIME, INTEGER, NULL, NUMBER, OBJECT, STRING, TIME
SELECTType of value to be added or updated.true
valueValueARRAY
Items []
ARRAY_BUILDERValue to be added or updated.true
valueValueBOOLEAN
Options true, false
SELECTValue to be added or updated.true
valueValueDATEDATEValue to be added or updated.true
valueValueDATE_TIMEDATE_TIMEValue to be added or updated.true
valueValueINTEGERINTEGERValue to be added or updated.true
valueValueNULLNULLValue to be added or updated.true
valueValueNUMBERNUMBERValue to be added or updated.true
valueValueOBJECT
Properties {}
OBJECT_BUILDERValue to be added or updated.true
valueValueSTRINGTEXTValue to be added or updated.true
valueValueTIMETIMEValue to be added or updated.true

JSON Example

{
"label" : "Add Value to the Object by Key",
"name" : "addValueByKey",
"parameters" : {
"source" : { },
"key" : "",
"type" : "",
"value" : "00:00:00"
},
"type" : "objectHelper/v1/addValueByKey"
}

Add Key-Value Pairs to Object or Array

Name: addKeyValuePairs

Add values from list to object or array. If the source is object, the items in the list will be treated as Key-value pairs. If the value is array of objects, key-value pairs will be added to every object in the array.

Properties

NameLabelTypeControl TypeDescriptionRequired
sourceTypeType of Initial ObjectSTRING
Options ARRAY, OBJECT
SELECTType of initial object to be added or updated.true
sourceSourceARRAY
Items [{}]
ARRAY_BUILDERSource object to be added or updatedtrue
sourceSourceOBJECT
Properties {}
OBJECT_BUILDERSource object to be added or updatedtrue
valueKey-Value PairsOBJECT
Properties {}
OBJECT_BUILDERKey-Value pairs to be added or updated.true

JSON Example

{
"label" : "Add Key-Value Pairs to Object or Array",
"name" : "addKeyValuePairs",
"parameters" : {
"sourceType" : "",
"source" : { },
"value" : { }
},
"type" : "objectHelper/v1/addKeyValuePairs"
}

Contains

Name: contains

Checks if the given key exists in the given object.

Properties

NameLabelTypeControl TypeDescriptionRequired
inputInputOBJECT
Properties {}
OBJECT_BUILDERObject that you’d like to check.true
keyKeySTRINGTEXTKey to check for existence.true

Output

Type: BOOLEAN

JSON Example

{
"label" : "Contains",
"name" : "contains",
"parameters" : {
"input" : { },
"key" : ""
},
"type" : "objectHelper/v1/contains"
}

Delete Key-Value Pair

Name: deleteKeyValuePair

Deletes a key-value pair in the given object by the specified key. Returns the modified object.

Properties

NameLabelTypeControl TypeDescriptionRequired
inputInputOBJECT
Properties {}
OBJECT_BUILDERThe object from which to delete the key-value pair.true
keyKeySTRINGTEXTThe key of the key-value pair to delete.true

JSON Example

{
"label" : "Delete Key-Value Pair",
"name" : "deleteKeyValuePair",
"parameters" : {
"input" : { },
"key" : ""
},
"type" : "objectHelper/v1/deleteKeyValuePair"
}

Equals

Name: equals

Compares two objects and returns true if they are equal.

Properties

NameLabelTypeControl TypeDescriptionRequired
sourceSourceOBJECT
Properties {}
OBJECT_BUILDERThe source object to compare.true
targetTargetOBJECT
Properties {}
OBJECT_BUILDERThe target object to compare against.true

Output

Type: BOOLEAN

JSON Example

{
"label" : "Equals",
"name" : "equals",
"parameters" : {
"source" : { },
"target" : { }
},
"type" : "objectHelper/v1/equals"
}

Merge Two Objects

Name: mergeTwoObjects

Merge two objects into one. If there is any property with the same name, the source value will be used.

Properties

NameLabelTypeControl TypeDescriptionRequired
sourceSourceOBJECT
Properties {}
OBJECT_BUILDERThe source object to merge.true
targetTargetOBJECT
Properties {}
OBJECT_BUILDERThe target object to merge into.true

JSON Example

{
"label" : "Merge Two Objects",
"name" : "mergeTwoObjects",
"parameters" : {
"source" : { },
"target" : { }
},
"type" : "objectHelper/v1/mergeTwoObjects"
}