Skip to content

Commit

Permalink
Add loaderror_if_empty option to load_*
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike committed Jan 11, 2024
1 parent 22f269a commit 292aa4c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions documentation/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,11 @@ Examples:
# Load YAML into existing dictionary
mydict = load_yaml_into_existing_dict(existing_dict, "my_yaml.yaml")

# Load JSON
mydict = load_json("my_json.yaml")
# Load JSON raising a LoadError if the file is empty
mydict = load_json("my_json.json")

# Load JSON returning None if the file is empty
mydict = load_json("my_json.json", loaderror_if_empty=False)

# Load 2 JSONs and merge into dictionary
mydict = load_and_merge_json("my_json1.json", "my_json2.json")
Expand Down

0 comments on commit 292aa4c

Please sign in to comment.