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

Being able to serialize a dictionary containing objects to be serialized. #10

Open
CustomEntity opened this issue Jan 11, 2021 · 3 comments

Comments

@CustomEntity
Copy link

CustomEntity commented Jan 11, 2021

Hello, would you like to know if it would be possible to add a way to serialize a dictionary please?

Because when I make this code, it works.

st = Story([Action(Chapter("Chapitre 1"), "Discussion", "Contenu"), Action(Chapter("Chapitre 1"), "Discussion", "Contenu")]) print(pykson.Pykson().to_json(st))

But when I want to implement my DAG, I cannot.

graph = { Action(Chapter("Chapitre 1"), "Discussion", "Contenu"): [Action(Chapter("Chapitre 1"), "Discussion", "Contenu")], Action(Chapter("Chapitre 1"), "Discussion", "Contenu"): [Action(Chapter("Chapitre 1"), "Discussion", "Contenu"), Action(Chapter("Chapitre 1"), "Discussion", "Contenu")], Action(Chapter("Chapitre 1"), "Discussion", "Contenu"): [Action(Chapter("Chapitre 1"), "Discussion", "Contenu"), Action(Chapter("Chapitre 1"), "Discussion", "Contenu")], Action(Chapter("Chapitre 1"), "Discussion", "Contenu"): [Action(Chapter("Chapitre 1"), "Discussion", "Contenu")]} print(pykson.Pykson().to_json(graph))

Looking forward to hearing from you, thanks !

@sinarezaei
Copy link
Owner

Can you please give an example of the json result you want to get after serializing graph? You want json keys to be complex objects?

@CustomEntity
Copy link
Author

I have no idea what it's going to look like in the end, but yes, with a complex object as a key

@OverShifted
Copy link

Hi.
In the JSON standard; only string keys are allowed. you can't use other things like a JSON object as a key, even though it is possible as a value (obviously).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants