$ open source · GPL-3.0 — need a commercial license? imqueue.com →

BaseModel.toJSON() method

Serializes this instance, honouring the returning column list.

Signature:

toJSON(): any;

Returns:

any

A plain object, ready to send over the wire.

Remarks

Sequelize's own toJSON() emits the loaded attributes. This one also picks up an associated instance, or an array of them, that those attributes do not already cover, and then — if the last write named the columns to return — drops every property that was not named.