Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make GraphNode serializable to JSON #11625

Open
buddha314 opened this issue Jan 23, 2025 · 0 comments
Open

Make GraphNode serializable to JSON #11625

buddha314 opened this issue Jan 23, 2025 · 0 comments

Comments

@buddha314
Copy link

buddha314 commented Jan 23, 2025

Describe the project you are working on

An enterprise application that uses logic graphs for decision support and business intelligence.

Describe the problem or limitation you are having in your project

Once a graph is constructed in GraphEdit, the contents need to be POSTed to our intelligence engine for analysis. It appears none of the Graph* nodes are JSON serializable so we are having to write our own serialization every time.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

JSON serialization is a key feature in modern applications and interoperability. WIth this feature could easily tie our logic graphs (and other visual-coding derived knowledge) to our cloud applications for bi-directional communication.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

A new method such as .to_json() for classes child to GraphElement

Consider a custom class with three fields, Name, Age, Zip Code and instance x.

x.to_json()

{
  "id": GraphNode@1234,
  "class": "AgeGenderZip",
  data = {
    "name": "Godette",
    "age": 12
    "zip": 90210
  }
 },
edges: [ <inlinks>, <outlinks>]
} 

If this enhancement will not be used often, can it be worked around with a few lines of script?

Perhaps, but not a few. Many languages support serialization routines for all objects. It's like this could be written into the "Control" node or such like.

Is there a reason why this should be core and not an add-on in the asset library?

Requires changes in the GraphNode source.

@Calinou Calinou changed the title Make GraphNode JSON serializable Make GraphNode serializable to JSON Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants