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

support json.dumps #49

Open
landall opened this issue Dec 9, 2021 · 1 comment
Open

support json.dumps #49

landall opened this issue Dec 9, 2021 · 1 comment

Comments

@landall
Copy link

landall commented Dec 9, 2021

SharedMemoryDict cannot be serialized by json.dumps.

I have to use ._read_memory() to do so.
It seems strange.

Maybe we should add a .dict() method to convert it to ordinary dict?

@spaceone
Copy link
Contributor

spaceone commented Dec 9, 2021

This would be solved by #42 which allows giving a JSONEncoder subclass.
A example usage is something like this: https://github.com/spaceone/shared-memory-dict/blob/json-nested-dictionary-serializer/shared_memory_dict/nested_json_serializer.py#L15-L32

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

2 participants