Skip to main content

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 than json.

  • Parameters

    • obj (Any): The object to write.
    • path (Union[str, Path]): The path to the JSON file. Defaults to None, indicating writing to tmp.json in the current directory.
    • **kwargs: Additional parameters for ujson.dump.
  • Example

    import docsaidkit as D

    data = {'key': 'value'}
    D.dump_json(data)