Search
Serializing Diagrams

A diagram can be saved as JSON string by calling the toJson method. The produced JSON string could be saved in browser's local storage or sent to a web server to store in a database or a file. Later the diagram's contents can be restored by calling fromJson. The JSON strings are also compatible with MindFusion's ASP.NET MVC API and can be loaded in .NET Diagram object to inspect the diagram model on server side.

It is also possible to save a diagram as an XML document. To do that, call the saveToXml method of the Diagram class. To deserialize a diagram back from its XML representation, call the loadFromXml method. The same XML format is supported by all MindFusion diagram components for mobile, desktop and web platforms.

The saveToString and loadFromString methods let you serialize or deserialize to/from either JSON or XML strings produced by the other methods described above.