To create and clone a JSON object with JavaScript, we can use the spread operator.
For instance, we write
const newJsonObj = { ...jsonObj };
to shallow copy the properties of the jsonObj
object into a new object and assign the new object to newJsonObj
.