You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking into exporting the JSON for a graph using Cytoscape.js to the desktop Cytoscape application. It seems that both cy.json() (when at least one compound node is present within the graph) and ele.json() (where ele refers to a compound node) generate JSON objects that cannot be passed into JSON.stringify(), and therefore can't (as far as I can tell) be exported to the desktop Cytoscape application.
When compound nodes are not in the graph, the JSON generated is not circular (calling stringify on it works). I've tested this phenomenon by opening graphs with compound nodes, calling JSON.stringify(cy.json()); from my browser's console, and observing an Uncaught TypeError: Converting circular structure to JSON error. Calling cy.remove() on all of the compound nodes in the graph results in the stringify call working without error.
For reference, I'm running Chromium 55.0.2883.75 as my browser, on Debian 8.6.
The text was updated successfully, but these errors were encountered:
I just confirmed that cy.json() and ele.json() are serialisable. There are no circular references when I tried.
You may have circular references in what you're putting in .data(). You're only allowed to put plain JSON data in .data(), as the docs say. Complex objects and other temp data goes in .scratch(). Please confirm your data is correct, and provide an example graph JSON file that illustrates the bug.
My apologies—this was my fault. I was storing collections of certain elements within the .data() fields for compound nodes.
I did not notice anywhere in the documentation that certain types of data could not be stored in .data(), although I see now that the documentation does mention that non-JSON data can be stored in .scratch(). I'm sorry for the confusion.
I'm looking into exporting the JSON for a graph using Cytoscape.js to the desktop Cytoscape application. It seems that both
cy.json()
(when at least one compound node is present within the graph) andele.json()
(whereele
refers to a compound node) generate JSON objects that cannot be passed intoJSON.stringify()
, and therefore can't (as far as I can tell) be exported to the desktop Cytoscape application.When compound nodes are not in the graph, the JSON generated is not circular (calling stringify on it works). I've tested this phenomenon by opening graphs with compound nodes, calling
JSON.stringify(cy.json());
from my browser's console, and observing anUncaught TypeError: Converting circular structure to JSON
error. Callingcy.remove()
on all of the compound nodes in the graph results in the stringify call working without error.For reference, I'm running Chromium 55.0.2883.75 as my browser, on Debian 8.6.
The text was updated successfully, but these errors were encountered: