Skip to main content

toobj: Transform a dictionary into an object

Python package that transforms flat or nested dictionaries into objects.

Installation

pip install toobj

ToObj

Transforms flat or nested dictionaries into objects.

Args

Parameter Type Description
d dict Dictionary to convert in Python object.
from toobj import ToObj

d = dict(...)
obj = ToObj(d)

Usage

from toobj import ToObj

# Sample data
data = {
    'name': 'Alice',
    'age': 30,
    'address': {
        'city': 'Wonderland',
        'zipcode': 12345,
        'coordinates': {
            'lat': 52.5200,
            'long': 13.4050,
            'meta': {
                'continent': 'Europe',
                'population': 3000000
            }
        }
    },
    'contacts': {
        'email': 'alice@example.com',
        'phones': [
            {'type': 'home', 'number': '123-456'},
            {'type': 'work', 'number': '789-101'}
        ]
    },
    'hobbies': ['reading', 'traveling', {'name': 'coding', 'level': 'advanced'}]
}

# Dictionary to object
data_obj = ToObj(data)
>>> data_obj.name
'Alice'
>>> data_obj.address.zipcode
12345
>>> data_obj.address.coordinates.meta.continent
'Europe'
>>> data_obj.contacts.phones[0].number
'123-456'
>>> data_obj.hobbies[2].name
'coding'

Metadata

Release files for toobj 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for toobj 0.0.1
File Size Uploaded Provenance Actions
toobj-0.0.1.tar.gz 14.5 kB Without provenance Details for toobj-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for toobj 0.0.1
File Interpreter ABI Platform Actions
toobj-0.0.1-py3-none-any.whl Python 3 none any Details for toobj-0.0.1-py3-none-any.whl

Total release size: 29.0 kB

Release files / toobj-0.0.1.tar.gz

Download URL toobj-0.0.1.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7b99e5db88635acb68fd38b60399521237d2a9fbad9545a50f1dbcb04b89b7a4
BLAKE2b-256 checksum
How to use checksums
9d25debc9199acd2a5e46fcce3ca17000ebf2d8a1be1ab8cf2023da0dbee7c83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release files / toobj-0.0.1-py3-none-any.whl

Download URL toobj-0.0.1-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e6fe1982e4f2a3a8b074503080fad4d3f761b2d1d3cb7ae32663e0285b63d5b9
BLAKE2b-256 checksum
How to use checksums
b0def9f64a26d2a8f42d8434e4d761afb4357afe21d655aa5c27071f4f9aa9ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Security for toobj 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page