dump_json
dump_json(obj: Any, path: Union[str, Path] = None, **kwargs) -> None
-
Description
Write an object to JSON. Here,
ujson
is used for writing because it is much faster thanjson
. -
Parameters
- obj (
Any
): The object to write. - path (
Union[str, Path]
): The path to the JSON file. Defaults to None, indicating writing totmp.json
in the current directory. **kwargs
: Additional parameters forujson.dump
.
- obj (
-
Example
import docsaidkit as D
data = {'key': 'value'}
D.dump_json(data)