Skip to content

Latest commit

 

History

History
42 lines (28 loc) · 790 Bytes

File metadata and controls

42 lines (28 loc) · 790 Bytes

PyJSONUtils

A Python library for using JSON files.

Usage

To open a file:

from pyjsonutils import pyjsonutils
pyjsonutils.open_file_as_dict("file_path.json")

To write to a file:

from pyjsonutils import pyjsonutils
pyjsonutils.write_dict_to_file(dictionary, "file_path.json")

To update a JSON file:

from pyjsonutils import pyjsonutils
pyjsonutils.update_json_file("file_path.json")

Find the first key having a given value:

from pyjsonutils import pyjsonutils
pyjsonutils.find_key_from_value(dictionary, value)

Create a default value for a key if the key does not exist:

from pyjsonutils import pyjsonutils
pyjsonutils.create_default_if_key_not_there(dictionary, key, default_value)