Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Add json_serializable option to dict-conversion #10

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

phohenberger
Copy link
Collaborator

This works with the ZnDraw branch json_serializable

Comment on lines +225 to +232
if (
not isinstance(value, (int, float, str, list, dict, bool))
and value is not None
):
print("Warning: {} is not JSON serializable".format(type(value)))
del obj[key]
elif isinstance(value, dict):
obj[key] = default_serializer(value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer

try:
  json.dumps(value)
except Jsonserializeableerror:
   log
   del

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

Successfully merging this pull request may close these issues.

2 participants