stunn / jssketch

1 stars 0 forks source link

Model.toJSON is a mess. #16

Closed mattlunn closed 11 years ago

mattlunn commented 11 years ago

Currently, we return the reference to the properties object in the toJSON method. This is bad as we trust callers not to modify the properties object (wrongly).

We cannot simply call JSON.parse(JSON.stringify(this.properties)) as this fails on circular references.

... options?

mattlunn commented 11 years ago

FWIW, this is what is causing the Dependency Manager's toSerializedForm to fail, as it is deleting properties on the toJSON object it gets back (which is currently actual properties objects.