Return a dict representation of an object. Note: Unfortunately this function is not as efficient as it could be because it first dumps the object to a json string and then loads it back into a dictionary. Args: obj: The object to dump. Returns:
(obj: Any)
| 42 | |
| 43 | |
| 44 | def dumpd(obj: Any) -> Any: |
| 45 | """Return a dict representation of an object. |
| 46 | |
| 47 | Note: |
| 48 | Unfortunately this function is not as efficient as it could be |
| 49 | because it first dumps the object to a json string and then loads it |
| 50 | back into a dictionary. |
| 51 | |
| 52 | Args: |
| 53 | obj: The object to dump. |
| 54 | |
| 55 | Returns: |
| 56 | dictionary that can be serialized to json using json.dumps |
| 57 | """ |
| 58 | return json.loads(dumps(obj)) |