Replies: 1 comment
-
|
I have the following work around: if isinstance(obj, list) or hasattr(obj,'pop'):
return [nested_object_to_dict(item) for item in obj]
elif isinstance(obj, dict) or hasattr(obj,'keys'):
obj = dict(obj)
return {key: nested_object_to_dict(value) for key, value in obj.items()}
elif hasattr(obj, '__dict__'):
return nested_object_to_dict(obj.__dict__)
else:
return obj |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to check if an item is a projectobject vs a proxylist?
I have the following function, but type(obj) returns "proxy" vs proxylist or proxyobject. I need to do this to create a deepcopy of the data when comparing it for updates. The object is cell.get_data() and is a nested dictionary with list and dictionaries.
like so:
Beta Was this translation helpful? Give feedback.
All reactions