Serializes a Resource API Object to a plain object that would be fit for JSON.stringify.

resource.toPlainObject( settings )

This methods attempts to aggregate all non-empty properties. Not all properties are supported. If the resulting object does not look as desired, it is best to write your own serialization function from scratch.

The optional settings argument contains properties that affect serialization:

collapseExtendedProps If set to true, the extendedProps hash will be merged into the root outputted object. If false (the default), extendedProps will be its own object nested within the root object.
collapseColor If set to true, and the eventBackgroundColor and eventBorderColor properties are identical, they will be merged and outputted as a single eventColor property. If false (the default), they will be outputted as separate properties.

The toPlainObject method is aliased to the toJSON method so that JSON.stringify works.