stable_learning_control.utils.serialization_utils

Module used for serializing json objects.

Note

This module was based on spinningup repository.

Functions

convert_json(obj)

Convert obj to a version which can be serialised with JSON.

is_json_serializable(v)

Check if object can be serialised with JSON.

save_to_json(input_object, output_filename, output_path)

Save python object to Json file. This method will serialize the object to

load_from_json(path)

Load data from json file.

Module Contents

stable_learning_control.utils.serialization_utils.convert_json(obj)[source]

Convert obj to a version which can be serialised with JSON.

Parameters:

obj (object) – Object which you want to convert to json.

Returns:

Serialised json object.

Return type:

object

stable_learning_control.utils.serialization_utils.is_json_serializable(v)[source]

Check if object can be serialised with JSON.

Parameters:

v (object) – object you want to check.

Returns:

Boolean specifying whether the object can be serialised by json.

Return type:

bool

stable_learning_control.utils.serialization_utils.save_to_json(input_object, output_filename, output_path)[source]

Save python object to Json file. This method will serialize the object to JSON, while handling anything which can’t be serialized in a graceful way (writing as informative a string as possible).

Parameters:
  • input_object (object) – The input object you want to save.

  • output_filename (str) – The output filename.

  • output_path (str) – The output path.

stable_learning_control.utils.serialization_utils.load_from_json(path)[source]

Load data from json file.

Parameters:

path (str) – The path of the json file you want to load.

Returns:

The Json load object.

Return type:

(object)