···214214};
215215216216Anchor.prototype.toJSON = function () {
217217- var result = {};
218218- var optionKeys = this.constructor.optionKeys;
217217+ var type = this.type;
218218+ var ignoreChildren = this.ignoreChildren || false;
219219+ var result = { type: type };
220220+ var optionKeys = [...this.constructor.optionKeys];
219221220220- [...optionKeys, 'children'].forEach(function (key) {
222222+ if (!ignoreChildren) {
223223+ optionKeys = [...optionKeys, 'children'];
224224+ }
225225+226226+ optionKeys.forEach(function ( key ) {
221227 if (['addTo', 'dragRotate', 'element', 'resize'].includes(key)) return;
222228 var value = this[key];
223229 var defaults = this.constructor.defaults;