Jsobj provides JavaScript-Style Objects in Python.
Project description
jsobj provides JavaScript-Style Objects in Python. It is based on jsobject, but returns None if you try accessing non-existent keys instead of throwing an exception.
Homepage and documentation: https://github.com/gkovacs/jsobj
Example: “Hello World” with jsobj
from jsobject import Object
data = {
"boolean": True,
"null": None,
"number": 123,
"objectA": {'a': 'b', 'c': {'d': 'e', 'f': {'g': 'h'}}}
}
jso = Object(data)
print(jso.boolean) # True
print(jso.null) # None
print(jso.number) # 123
print(jso.objectA) # {'a': 'b', 'c': {'d': 'e', 'f': {'g': 'h'}}}
print(jso.objectA.a) # b
print(jso.objectA.c.d) # e
print(jso.objectA.c.f.g) # h
Installation
$ pip install jsobj
License
MIT
Credits
Geza Kovacs. Based on jsobject by Marcin Wierzbanowski
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
jsobj-1.0.1.tar.gz
(3.8 kB
view hashes)
Built Distribution
Close
Hashes for jsobj-1.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01cbebea8b187c4d031a6d269c56bd5618390f7e43b8fbba54ca827605aad357 |
|
MD5 | 6cf3cf42ffde4e1f208a1ee89e46c9df |
|
BLAKE2b-256 | b2febbacf09e7b1f317cbb441ef448ccb778fd34e39d49700c146df6e5e68cdb |