dump_json
dump_json(obj: Any, path: Union[str, Path] = None, **kwargs) -> None
-
Description: Writes an object to a JSON file. It uses
ujson
for faster writing compared to the standardjson
module. -
Parameters:
- obj (
Any
): The object to write. - path (
Union[str, Path]
): The path for the JSON file. Defaults to None, which writes totmp.json
in the current directory. - kwargs: Additional parameters for
ujson.dump
.
- obj (
-
Example:
import capybara as cb
data = {'key': 'value'}
cb.dump_json(data)