save_json()¶
- audeer.save_json(file, obj, *, indent=None, separators=None)[source]¶
Save object to JSON file.
- Parameters:
obj (
object) – object to store in JSON fileindent (
int|None) – indentation level in number of spaces. IfNonethe JSON will be compact without line breaksseparators (
tuple[str,str] |None) – tuple of item and key separators. IfNonedefaults to(", ", ": ")whenindentisNone, and(",", ": ")otherwise
Examples
>>> file = audeer.path("test.json") >>> audeer.save_json(file, {"a": 1}) >>> audeer.load_json(file) {'a': 1}