A small json Filehandler
Project description
NoirPi JSON Handler
This is a simple JSON Filehandler.
Installation
pip install noirpi-jsonhandler
FileIO Json Load
Load a JSON file
from jsonhandler.FileIO import FileIO
def load_json():
FileIO("./test.json")
or creates the file with a given value. If value is not given it uses an empty dict.
from jsonhandler.FileIO import FileIO
def load_json():
FileIO("./test.json", {"test": True})
FileIO Json Save
Save a JSON file
from jsonhandler.FileIO import FileIO
def save_json():
file = FileIO("./test.json")
file.save()
FileIO Json Replace
Replaces the content of a JSON file
from jsonhandler.FileIO import FileIO
def save_json():
file = FileIO("./test.json")
file.replace({"test": True})
FileIO Json File Check
Check if JSON file has valid Syntax
from jsonhandler.FileIO import FileIO
def check_json():
file = FileIO("./test.json")
file.is_valid_json()
FileIO Json Dict Validation
Check if JSON dictionary is has a valid syntax
from jsonhandler.FileIO import validate
def validate_json():
jsondict = {"test": "value"}
validate(jsondict)
FileIO get value
Gets a value from JSON File
from jsonhandler.FileIO import FileIO
def get_value():
file = FileIO("./test.json", {"test": {"key": True})
file["test"]
file["test", "key"]
FileIO set value in json file
Sets or adds a value inside a JSON File
from jsonhandler.FileIO import FileIO
def get_value():
file = FileIO("./test.json")
file["test", "key"] = True
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
Built Distribution
Close
Hashes for noirpi_jsonhandler-2.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9799de348b6fbf1c0fffab2b1760225af927730d306559a8a549e484715c536 |
|
MD5 | 48276fbacf918933cbf48297f5d7637a |
|
BLAKE2b-256 | 36b7abeeb0f44be346c34f42e995310328a930b48e9479e69c46eb7d8f5d6130 |