Errors Converting from JSON

I am converting a model to JSON and storing into a DB. . I am getting errors when i use the model.fromJSON method. I am getting errors converting back from JSON. The JSON looks ok. Appreciate any help you can give me.
Thanks

Information below

examples here :
property set error: Error: Link.routing value is not an instance of a constant of class Link: [object Object]
property set error: Error: Link.curve value is not an instance of a constant of class Link: [object Object]
property set error: Error: Link.routing value is not an instance of a constant of class Link: [object Object]
property set error: Error: Link.curve value is not an instance of a constant of class Link: [object Object]
property set error: Error: Link.routing value is not an instance of a constant of class Link: [object Object]
property set error: Error: Link.curve value is not an instance of a constant of class Link: [object Object]
property set error: Error: Link.routing value is not an instance of a constant of class Link: [object Object]

The JSON which is stored in the DB from the model.toJSON method is below

“jsonString” :
"{ “class”: “go.GraphLinksModel”,
\n “nodeDataArray”: [ \n{“key”:“a9LxFwk9ApG7ubpN7”, “text”:“Capability”,
“font”:“8pt serif”, “height”:60, “width”:150, “isShadowed”:true, “shadowColor”:“gray”,
“classType”:“capability”, “group”:“capability”, “shadow”:true, “shadowOffset”:{“class”:“go.Point”,
“x”:10, “y”:10}, “color”:{“class”:“go.Brush”, “type”:“Linear”, “start”:

{“class”:“go.Spot”, “x”:0, “y”:0.5, “offsetX”:0, “offsetY”:0}, “end”:{“class”:“go.Spot”, “x”:1, “y”:0.5, “offsetX”:0, “offsetY”:0},
“colorStops”:{“0”:"#FFD9BA", “1”:"#FFD9BA", “0.5”:"#FFD9BA"}}, “fig”:“RoundedRectangle”, “location”:“319.0000000000007 184.96108398437488”, “newElement”:false,
“category”:“capability”, “description”:“none”, “name”:“Capability”, “theID”:“a9LxFwk9ApG7ubpN7”, “theObject”:{“name”:“Capability”, “description”:“none”, “open”:true,
“fixedRoot”:false, “type”:"", “createdAt”:{“class”:“Date”, “value”:“2015-12-02T20:24:47.535Z”}, “createdBy”:“TuqcJqenyYcw8kzPr”, “text”:“Capability”, “theID”:“a9LxFwk9ApG7ubpN7”,
“key”:“a9LxFwk9ApG7ubpN7”, “category”:“capability”, “group”:“capability”, “classType”:“capability”}, “opacity”:1, “layerName”:“front”, “isGraphicShape”:false},\n{“newElement”:false,
“category”:“capability”, “description”:"", “name”:“group”, “text”:“capability”, “theID”:“group”, “theObject”:{“name”:“group”, “description”:“Group Node”, “parentID”:“0”,
“classType”:“capability”, “theID”:“group”}, “key”:“capability”, “opacity”:1, “shadow”:true, “shadowOffset”:{“class”:“go.Point”, “x”:10, “y”:10}, “shadowColor”:“gray”, “group”:"",
“color”:“grey”, “width”:150, “height”:60, “classType”:“capability”, “fig”:“RoundedRectangle”, “layerName”:“front”, “isGraphicShape”:false, “isGroup”:true},\n{“key”:“N2qa2ZhLej7tbhSFX”,
“text”:“Capability”, “font”:“8pt serif”, “height”:60, “width”:150, “isShadowed”:true, “shadowColor”:“gray”, “classType”:“capability”, “group”:“capability”, “shadow”:true,
“shadowOffset”:{“class”:“go.Point”, “x”:10, “y”:10}, “color”:{“class”:“go.Brush”, “type”:“Linear”, “start”:{“class”:“go.Spot”, “x”:0, “y”:0.5, “offsetX”:0, “offsetY”:0},
“end”:{“class”:“go.Spot”, “x”:1, “y”:0.5, “offsetX”:0, “offsetY”:0}, “colorStops”:{“0”:"#FFD9BA", “1”:"#FFD9BA", “0.5”:"#FFD9BA"}}, “fig”:“RoundedRectangle”, “location”:“319 294.961083984375”,
“newElement”:false, “category”:“capability”, “description”:“none”, “name”:“Capability”, “theID”:“N2qa2ZhLej7tbhSFX”, “theObject”:{“name”:“Capability”, “description”:“none”, “open”:true,
“fixedRoot”:false, “type”:"", “createdAt”:{“class”:“Date”, “value”:“2015-12-02T20:24:48.877Z”}, “createdBy”:“TuqcJqenyYcw8kzPr”, “text”:“Capability”, “theID”:“N2qa2ZhLej7tbhSFX”,
“key”:“N2qa2ZhLej7tbhSFX”, “category”:“capability”, “group”:“capability”, “classType”:“capability”}, “opacity”:1, “layerName”:“front”, “isGraphicShape”:false}\n ],
\n “linkDataArray”: [ \n{“from”:“a9LxFwk9ApG7ubpN7”, “to”:“N2qa2ZhLej7tbhSFX”, “curve”:{“cc”:“JumpOver”, “vG”:11}, “routing”:{“cc”:“Orthogonal”, “vG”:2}},\n{“from”:“a9LxFwk9ApG7ubpN7”,
“to”:“N2qa2ZhLej7tbhSFX”, “curve”:{“cc”:“JumpOver”, “vG”:11}, “routing”:{“cc”:“Orthogonal”, “vG”:2}}\n ]}",

Did you set the data properties of routing and curve in your code? Or do you have a TwoWay Binding on Link.routing and Link.curve, and you modified those Link properties in your code?

If so, you aren’t converting the values, which are instances of EnumValue (an internal class) into strings so that they can be serialized/deserialized when converting to/from JSON-formatted text.

You’ll want to do something like:

  $(go.Link,
    . . .,
    new go.Binding("routing", "routing", go.Binding.parseEnum(go.Link, go.Link.Normal)).makeTwoWay(go.Binding.toString),
    . . .

You can specify the default value to return when there’s no value for the data.routing property.

Thanks Walter - I will try your suggestion

Thanks Walter this did the trick

In version 1.6 Model.toJson and Model.fromJson will automatically serialize/deserialize EnumValues.

However, using the Binding conversions to and from strings is still suggested as a way to reduce the size of the JSON-formatted text.