Functions | |
| def | load_commented_json (filename) |
| def | merge_dict (base, delta) |
| def | uncomment_json (commented_json_str) |
| def mycroft.util.json_helper.load_commented_json | ( | filename | ) |
Loads an JSON file, ignoring comments
Supports a trivial extension to the JSON file format. Allow comments
to be embedded within the JSON, requiring that a comment be on an
independent line starting with '//' or '#'.
NOTE: A file created with these style comments will break strict JSON
parsers. This is similar to but lighter-weight than "human json"
proposed at https://hjson.org
Args:
filename (str): path to the commented JSON file
Returns:
obj: decoded Python object
Definition at line 35 of file json_helper.py.
| def mycroft.util.json_helper.merge_dict | ( | base, | |
| delta | |||
| ) |
Recursively merging configuration dictionaries.
Args:
base: Target for merge
delta: Dictionary to merge into base
Definition at line 18 of file json_helper.py.
| def mycroft.util.json_helper.uncomment_json | ( | commented_json_str | ) |
Removes comments from a JSON string.
Supporting a trivial extension to the JSON format. Allow comments
to be embedded within the JSON, requiring that a comment be on an
independent line starting with '//' or '#'.
Example...
{
// comment
'name' : 'value'
}
Args:
commented_json_str (str): a JSON string
Returns:
str: uncommented, legal JSON
Definition at line 58 of file json_helper.py.