How can I convert a TypedObject to a nested dictionary in Python?
-
28-10-2019 - |
Question
I am using pyAMF and I do receive a TypedObject
that is in fact a nested dictionary. I want to convert this to a python dictionary.
Solution
You should be able to wrap it in dict(obj)
or call obj.copy()
to convert it:
>>> type(o)
<class 'pyamf.TypedObject'>
>>> type(o.copy())
<type 'dict'>
>>> o.copy()
{'abc': 123}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow