Skip to main content
17-Peridot
February 2, 2022
Solved

How to merge two objects in Thingworx?

  • February 2, 2022
  • 1 reply
  • 1247 views

We are trying to merge two objects as follows, 

 

const object1 = {
 name: 'Flavio'
}
const object2 = {
 age: 35
}
result = {...object1, ...object2 }

 

We are getting syntax error with Thingworx. 

 

How can we do with Thingworx?

Best answer by BogdanM

You can use Object.assign.

 

For your specific example:

 

result = Object.assign({}, object1, object2)

 

 

1 reply

BogdanM1-VisitorAnswer
1-Visitor
February 2, 2022

You can use Object.assign.

 

For your specific example:

 

result = Object.assign({}, object1, object2)