Convert dict to (js)object
Project description
dict2object
dict2object is a dictionary that supports attribute-style access, a la JavaScript.
>>> user = Object({
... "name": "John",
... "age": 18,
... "job": {
... "name": "programmer",
... "experience": 5
... }
... })
>>> user.name
'Jhon'
>>> user.job.name
'programmer'
Dictionary Methods
A dict2object is a subclass of dict
; it supports all the methods a dict
does:
>>> user.keys()
['name', 'age', 'job']
Serialization
Bunches happily and transparently serialize from JSON.
>>> user = Object.load('{"name": "Anna", "age": 20}')
>>> user.name
'Anna'
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
Built Distribution
Close
Hashes for dict2object-gaponukz-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cf9a13f86908d422e319a769c01ea146afd97f3d2f67261cc20aa6094009a09 |
|
MD5 | 1adb4718fb6c648799187c64eb77fcc8 |
|
BLAKE2b-256 | 713537e5ced98422c5e86c9a9c5215173d43ca702711a0ae3275aa780e015306 |
Close
Hashes for dict2object_gaponukz-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f03af13cdfa59dc0c6ffe1787ee86d9ce70fedd230be64dc94ccf577a16be3c |
|
MD5 | 768d2aff7ece89b5b4733a7d21bf2275 |
|
BLAKE2b-256 | fbe259670de8e578fa8a1061caf923e4a43353d79677ba5a59b1c8cbe44e8bc4 |