torchoutil.serialization.json module

dump_json(
data: Any,
fpath: str | Path | None = None,
*,
overwrite: bool = True,
make_parents: bool = True,
to_builtins: bool = False,
indent: int | None = 4,
ensure_ascii: bool = False,
**json_dump_kwds,
) str[source]

Dump content to JSON format into a string and/or file.

to_json(
data: Any,
fpath: str | Path | None = None,
*,
overwrite: bool = True,
make_parents: bool = True,
to_builtins: bool = False,
indent: int | None = 4,
ensure_ascii: bool = False,
**json_dump_kwds,
) str[source]

Dump content to JSON format into a string and/or file.