Skip to main content

jobject: A dictionary replacement that gives additional access to data using C struct notation, just like JavaScript Objects

Project description

jobject

pypi version MIT License

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


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 details)

Uploaded Source

File details

Details for the file jobject-1.0.2.tar.gz.

File metadata

  • Download URL: jobject-1.0.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.31.0 rfc3986/1.5.0 tqdm/4.65.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for jobject-1.0.2.tar.gz
Algorithm Hash digest
SHA256 4474a0360420623265b53c6bd1beb6a4bc1d0e94331f6a2e23ccfc2b312c382c
MD5 faa850c1b4dd46dde04f46bd672f6ca6
BLAKE2b-256 1ddcc92a9dd48d6027c10a406e33ebcc879377ca834ea5d93f0bd2c215841bca

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page