merge (Merge objects)

Prev Next

$merge can be used to merge multiple objects into one new object. All object fields of the previous object will be overwritten.

Tooltip

Syntax: $merge(object1[,object2,...objectN]])

Parameter

Description

object1

The first object

object2

The second object

objectN

The nth object

Returns a merged object, but at least a copy of the first object.

Example: $merge($el(5),$el(10)) – Returns a new object which is a merge of the value of element 5 and element 6.

Syntax

$merge(object1[,object2,...objectN]])

Parameter

Name

Description

object1

The first object

object2

The second object

objectN

The nth object

Return value

A merged object, but at least a copy of the first object.

Example

Syntax

Variables

Result

$merge($var(a),$var(b))

a = {
	"name": "Hans",
	"country": "Austria"
}
b = {
	"country": "German",
	"city": "Munich"
}
{
	"name": "Hans",
	"country": "German",
	"city": "Munich"
}