Once you have started building an application with FabricJS it won't be late when you realize that you will need to save results of the canvas/its contents to server. Or may exporting them as files to the client. For this very purpose you will need canvas serialization. Now some of you might ask Why Serialization we can save it as an image. So the answer would Saving image to a server needs bandwidth and text proves much better in this case.
- JSON.stringify(canvas) - implicitly calls toJSON method on passed object. Gives String representation
- canvas.toObject() - returns the same representation as toJSON, only in a form of actual object
- canvas.toSVG() - returns an SVG representation of the canvas