Skip to main content

Convert dict to (js)object

Project description

dict2object

dict2object is a dictionary that supports attribute-style access, a la JavaScript

PyPI version downloads license

Install

pip install dict2object-gaponukz

Use

from dict2object.dict2object import Object

user1 = Object(
    name="Adam",
    age = 18,
)

user2 = Object({
    "name": "Max",
    "age": 18,
    "job": {
        "name": "developer",
        "experience": 3
    }
})

user3 = user2.copy()
user3.job.name = "full stack developer"

print(user3)

user4 = Object.load('{"name": "Anna", "age": 20}')
user4.job = user3.job

print(user4)

Requirements

  • python >= 3.8

You can use dict2object with python 3.8.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dict2object-gaponukz-0.0.5.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

dict2object_gaponukz-0.0.5-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page