Skip to main content

Python dictionary with automatic and arbitrary levels of nestedness

Project description

jict

jict is basically a nested dict.
with some extra features

simple use example :

from jict import jict

jct = jict()
jct['level1']['level2']['level3'] = 'created nested dictionary'

print(jct)
# output :
# {
#   "level1": {
#     "level2": {
#       "level3": "created nested dictionary"
#     }
#   }
# }

# jict to dict
mydict = jct.dict()

jict utilities:

from jict import jict

# our jict
jct = jict({
    'val': { 'list':[ [{ 'find-me': 'secret' }] ] }
})

# we can easly find the key we need
print(jct.get('find-me'))

# we also can rename the keys
# output : secret
jct.rename('find-me','password')
print(jct.get('find-me'))
# output : None
print(jct.get('password'))
# output : secret

# we also can replace values
jct.replace('password','mypass')
print(jct.get('password'))
# output : mypass


def foo(val):
    val[0][0]['name'] = 'jict'
    return val

# we also can replace with callbacks and multiple values
jct.replace({
    'password':'mypass',
    'list': foo,
})

# callbacks also work with this: jct.replace('list' , foo)

print(jct.get('list'))
# output: [[{'password': 'mypass', 'name': 'jict'}]]

also you can easly load a .json , .yaml file

from jict import jict

jctj = jict('test.json')
print(jctj)
# output :
# {
#   "test": "json-content"
# }

jcty = jict('test.yaml')
print(jctj)
# output :
# {
#   "test": "yaml-content"
# }

# if you want to save the modifed values
jctj.save()
jcty.save()

# you can also save to another file
jcty.save('newfile.json')

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

jict-2.5.3.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

jict-2.5.3-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file jict-2.5.3.tar.gz.

File metadata

  • Download URL: jict-2.5.3.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.24.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.2

File hashes

Hashes for jict-2.5.3.tar.gz
Algorithm Hash digest
SHA256 e2debc928204cd32cedf84f1a9fb5f074a678bfdc5c54c360c48c3a88010e45e
MD5 de6f32b75d17c365f977ffb310bc238c
BLAKE2b-256 2909592c6f210bd0698aa9e1c1f5be19707755b9698f2c4295c90b60f3939d7a

See more details on using hashes here.

File details

Details for the file jict-2.5.3-py3-none-any.whl.

File metadata

  • Download URL: jict-2.5.3-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.24.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.2

File hashes

Hashes for jict-2.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ffe117df55a6df0776d472166e84fe4ee5b7994ae39d0e0ee79a2958a92209d4
MD5 a62fc0b7c59b1ba6be22aabc92d28356
BLAKE2b-256 f6c0dd63edc86267c9dc0cc3303df3b5e6bafc55045d2aa06791d9db7322aef2

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