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/
- 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
- 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')
- 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
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
config-json-0.0.3.tar.gz
(2.6 kB
view details)
Built Distribution
File details
Details for the file config-json-0.0.3.tar.gz
.
File metadata
- Download URL: config-json-0.0.3.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | f35cbd3c616eea715c92ee8870218156c59d6b99136812d8b98135ccc5a31fbe |
|
MD5 | aa2a25dba630e55cb493691934c3dba8 |
|
BLAKE2b-256 | ad863e591cb118ae295292269db899e4ebc8211cd8f5b1b839084b8bcb24bec9 |
File details
Details for the file config_json-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: config_json-0.0.3-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60da833f059dc0576063b67afa632d93441e5ce2df90866bebe795fdbc3d7a83 |
|
MD5 | 9526c0339fde5c1734026ac1cc05f5d4 |
|
BLAKE2b-256 | d584939c499f04a2f98e80da43793eb57cc0380f4abc5b5aadf31e1014a92f49 |