To save the stage as a JSON string with Konva, we can use the toJSON() method which serializes the Konva Node tree into text which can be saved in web storage or in an offline database. We can also serialize other nodes, including layers, groups, and shapes.
toJSON() method can’t save filters, images and event listeners. So it works for very small apps. For more complex cases read Best Practices