Serializing a diagram to JSON

Suppose I have a interface to drag, drop and connect nodes like in And the use have added some of the new nodes to the diagram.
Then is it possible to serialize the diagram that is customized by the user to JSON?

Yes, call the model.toJson method:

var jsonData = myDiagram.model.toJson();

To load the same json call, fromJson()

var newModel = Model.fromJson(jsonData);


Jonathan is basically right.
But when loading I don’t know if you can call a static method as if it were on an instance. I think you need to do what the samples and documentation do:

myDiagram.model = go.Model.fromJson(jsonData);

Oops, my bad sorry. Forgot the namespace!

Is it possible to store node positional information too?