param.parameterized.Parameters.serialize_parameters#
- Parameters.serialize_parameters(subset=None, mode='json')[source]#
Return the serialized parameters of the Parameterized object.
- Parameters:
subset (list, optional) – A list of parameter names to serialize. If None, all parameters will be serialized. Defaults to None.
mode (str, optional) – The serialization format. By default, only ‘json’ is supported. Defaults to ‘json’.
- Returns:
Any – The serialized value.
User Guide
———-
https (//param.holoviz.org/user_guide/Serialization_and_Persistence.html#serializing-with-json)
Examples
Create a Parameterized instance and serialize its parameters:
>>> import param >>> class P(param.Parameterized): ... a = param.Number() ... b = param.String() >>> p = P(a=1, b="hello")
Serialize parameters:
>>> serialized_data = p.param.serialize_parameters() >>> print(serialized_data) {"name": "P00002", "a": 1, "b": "hello"}