toJSON () {
    var data = {
      type: this.type
    }
    const schema = this.getSchema()
    for (const prop of schema) {
      let val = this._properties.get(prop.name)
      if (prop.isOptional() && val === undefined) continue
      if (isArray(val) || isObject(val)) {
        val = cloneDeep(val)
      }
      data[prop.name] = val
    }
    return data
  }
Convert node to JSON.

    @returns {Object} JSON representation of node.