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.2.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for jsobj-1.0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e235c2ccb97f9c1e360df89a1194b7189e1c036ff3b1e1fb4822305a0d8f2be |
|
MD5 | ed32ff54bba5f718ac2b4944c6ad999d |
|
BLAKE2b-256 | 5383c6c332e953cdf29299836bdff61b4b4bd7af4e32b89f7506e7d53737e708 |