Object To Dictionary
obj-todict is a simple utility to recursively convert objects to dictionaries. This can be particularly useful for serializing complex nested objects into JSON-compatible dictionaries.
Features
- Recursively converts objects, including nested lists and dictionaries, into dictionaries.
- Handles custom objects by converting their
__dict__attributes.
Installation
You can install the package using pip:
pip install obj-todict
Usage
Here's a quick example to get you started:
from obj_todict import todict
class Example:
def __init__(self, name, value):
self.name = name
self.value = value
example = Example('example', [1, 2, {'key': 'value'}])
print(todict(example))
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Metadata
Release files for obj-todict 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| obj_todict-0.1.0.tar.gz | 2.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| obj_todict-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.4 kB
Release files / obj_todict-0.1.0.tar.gz
| Download URL | obj_todict-0.1.0.tar.gz |
|---|---|
| Size | 2.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
46b514fdf2e4d030a42d63bbafee2f80a71bc25026c07e94f833c099f5b76710
|
|
BLAKE2b-256 checksum How to use checksums |
b81a00a8c9db2a425650e2d9e53b17b4321ffafcb811f8a5daccca6a441e4ed3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.10.12 Linux/6.9.3-76060903-generic
|
Release files / obj_todict-0.1.0-py3-none-any.whl
| Download URL | obj_todict-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a332453ec9fed92ace80f79a2eef44ebce9b3b4d662ccfbfd3b1c04d24b03e9
|
|
BLAKE2b-256 checksum How to use checksums |
6d7d878ec80eb935fa6d71ada876ec5998b492b711350e2bdfcfdf3c8413d14a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.10.12 Linux/6.9.3-76060903-generic
|