Skip to main content

An Easier Way to work with json files

Project description

Config-Json

An Easier Way to work with JSON configs

this library provide some top level method to make it easy to work with json Link: https://pypi.org/project/config-json/

  1. How to Use?
from jconf.config import Config

# u can either do
c = Config(config_name="main.json") # default name is main.json
# or
with Config(config_name="main.json")  as c:
    pass
  1. functions available
from jconf.config import Config

c = Config(config_name="main.json")
# returns all the keys from a json file
c.keys()
# returns all the values from a json file
c.values()
# gets the key from a json file
c.get('car')
# deletes a key from a json file
c.delete('car')
# update a value in a json file
c.update('car', 'tesla')
# sets a new key in json file
c.set('car2', 'ferari')
  1. instead of using functions you can also use:
from jconf.config import Config

c = Config('main.json')
# to/set or change a value
c['car'] = "name"
c['number_plate'] = ['3131', '3134', '3132']
# delete a key
del c['car']
# loop over a json file
for i in c:
    print(i) # returns a list of tuple with (key, value)
# updates / add to an existing key
c['car'] += {'model', 'year'}
# get a value
car = c['car']
  • Automatically creates the passed config_name if it doesn't exists

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

config-json-0.0.2.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

config_json-0.0.2-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file config-json-0.0.2.tar.gz.

File metadata

  • Download URL: config-json-0.0.2.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for config-json-0.0.2.tar.gz
Algorithm Hash digest
SHA256 79fb37f306e2de9bf29a6dad7f2f5c8b87212161cd00afe75355e36529c03e06
MD5 5e1a6a815cda92ea5c3e0fcda3a8d5fb
BLAKE2b-256 6ea101cd49203fa917589cf3be873a0cea79078faefc7f975b5d7fa367a75fc7

See more details on using hashes here.

File details

Details for the file config_json-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: config_json-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for config_json-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1348218588b3a62b20b9679c266229d0ded67da58c079175e91a4f08b4c3d7eb
MD5 1cb300713356d1a136947d397b1d8d12
BLAKE2b-256 ac457e105127be7c1e59ec255c96d5ab71f8ebc68d8665e468bd9c623def8734

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