robust_json

Provides a robust JSON encoder that can handle various types of objects.

Including dataclasses, paths, enums, namespaces, and functions.

Functions

json_dump

Serialize object to JSON file using RobustJSONEncoder.

json_dumps

Serialize object to JSON string using RobustJSONEncoder.

json_load

Load JSON from file and return as dictionary.

json_dump(obj, path)

Serialize object to JSON file using RobustJSONEncoder.

Parameters:
  • obj (Any)

  • path (Path | str)

Return type:

None

json_dumps(obj)

Serialize object to JSON string using RobustJSONEncoder.

Parameters:

obj (Any)

Return type:

str

json_load(path)

Load JSON from file and return as dictionary.

Parameters:

path (Path | str)

Return type:

dict