LSEQTree
LSEQTree copied to clipboard
Optimize json output by adding toJSON()
You can reduce the size of the JSON output significantly just by dropping the subCounter field as well as empty children fields.
toJSON() { return JSON.stringify(this, function(key, value) { return key === 'subCounter' || (key === 'children' && value.length === 0) ? undefined : value }) }
You would need to add a check for children in fromJSON to either default children to [] or skip processing children if the field is undefined.