jobject: A dictionary replacement that gives additional access to data using C struct notation, just like JavaScript Objects
Project description
jobject
jobject: A dictionary replacement that gives additional access to data using C struct notation, just like JavaScript Objects
Installation
pip install jobject
Import
from jobject import jobject
my_dict = jobject({'one': 1, 'two': 2, 'three': 3})
print(my_dict.three) # prints '3'
Inheritance
Because jobject extends dict it can be dropped into any code that requires dict notation or iteration. Because of this, jobject makes sure any dictionary instances that are passed to it are also converted into jobjects
from jobject import jobject
my_dict = jobject({
'one': {
'two': {
'three': 123
}
}
})
print(my_dict.one.two.three) # prints '123'
It will even follow lists to make sure everything under it is converted to a jobject
from jobject import jobject
my_dict = jobject({
'array': [
{'one': 1},
{'two': 2},
{'three': 3}
]
})
print(my_dict[2].three) # prints '3'
This even includes data set after the fact
from jobject import jobject
my_dict = jobject()
my_dict.test = {
'one': [
{'two': 2}
]
}
print(my_dict.test.one[0].two) # prints '2'
print(my_dict['test']['one'][0]['two']) # prints '2'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jobject-1.0.2.tar.gz
(4.2 kB
view hashes)