toJSON(options) {
    if (typeof (options && options.flattenMaps) === 'boolean' ? options.flattenMaps : true) {
      const ret = {};
      const keys = this.keys();
      for (const key of keys) {
        ret[key] = clone(this.get(key), options);
      }
      return ret;
    }

    return new Map(this);
  }
Converts this map to a native JavaScript Map for `JSON.stringify()`. Set
the `flattenMaps` option to convert this map to a POJO instead.

#### Example:

    doc.myMap.toJSON() instanceof Map; // true
    doc.myMap.toJSON({ flattenMaps: true }) instanceof Map; // false

@api public
@method toJSON
@param {Object} [options]
@param {Boolean} [options.flattenMaps=false] set to `true` to convert the map to a POJO rather than a native JavaScript map
@memberOf Map