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