I need to load my diagram model from a JSON file. I found an example here: Page Not Found -- Northwoods Software
I was able to reproduce the concepts used in this example, and everything worked except for the location of nodes, because this requires instantiation of go.Point. Because there’s no way to represent the instantiation of an object in JSON, how would I load location data from a JSON file?
For clarity, here is some sample code I would like to be able to represent in a JSON file:
diagram.model = new go.GraphLinksModel(
[
{ key: "0", color: "black", loc: new go.Point(0, 100), shape: "RoundedRectangle", },
{ key: "1", color: "black", loc: new go.Point(975, 100), shape: "RoundedRectangle", },
{ key: "2", color: "black", loc: new go.Point(300, 250), shape: "RoundedRectangle", },
{ key: "3", color: "black", loc: new go.Point(625, 255), shape: "RoundedRectangle", },
{ key: "4", color: "black", loc: new go.Point(300, 560), shape: "RoundedRectangle", },
{ key: "5", color: "black", loc: new go.Point(675, 560), shape: "RoundedRectangle", },
],