ERROR: trying to convert a GraphObject or Diagram or Model or Tool or Layout or UndoManager or other unknown data into JSON text

Hello,
we use gojs 2.1.15. My task is to animate transitions from state to state in time when nodes data is updated (animate appearing of new nodes, changing of nodes locations, sizes, links, etc.). My approach assumes that on every update after animation I save model using diagram.model.toJson() and then I recreate model and get node’s locations and animate relocation from them to new points and so on. Everything works fine, animation works properly, json is correct.

But on every call of diagram.model.toJson() I get in console Error:
go-debug.js:14 ERROR: trying to convert a GraphObject or Diagram or Model or Tool or Layout or UndoManager or other unknown data into JSON text: [object Map]

Right now I perform toJson() after transaction with animations.

I tried also

diagram.addModelChangedListener(function(evt) {
    if (evt.isTransactionFinished) { prevModel = diagram.model.toJson() }
  });

but have the same result - error in console.

Why could I receive this warning? Json is created ok, and everything works as intended despite of this Error.

Thanks

It means your Model contains a class that has no JSON-ready format. This will happen if you have some unexpected JavaScript object in the Model data, but its not clear why that would be. What are all your two-way bindings? Are you saving any data into the model (eg in to a node.data) manually?