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
Close
Hashes for dict2object-gaponukz-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5baa7bf31e1315a55b8af738c6e3b3d477fab6bd895f6044451cc6b8ec07429f |
|
MD5 | 9532bf887e321de5fde87ec219969fad |
|
BLAKE2b-256 | 4c8ea3d14368f7fc4e9b42b1d9b14db700dd5be52017963daf58b78b4f586072 |