param.parameterized.Parameters.deserialize_parameters#
- Parameters.deserialize_parameters(serialization, subset=None, mode='json') dict [source]#
Deserialize the given serialized data. This data can be used to create a Parameterized object or update the parameters of an existing Parameterized object.
- Parameters:
serialization (str) – The serialized parameter data as a JSON string.
subset (list of str, optional) – A list of parameter names to deserialize. If None, all parameters will be deserialized. Defaults to None.
mode (str, optional) – The serialization format. By default, only ‘json’ is supported. Defaults to ‘json’.
- Returns:
dict – A dictionary with parameter names as keys and deserialized values.
User Guide
———-
https (//param.holoviz.org/user_guide/Serialization_and_Persistence.html#serializing-with-json)
Examples
>>> import param >>> class P(param.Parameterized): ... a = param.Number() ... b = param.String() ... >>> serialized_data = '{"a": 1, "b": "hello"}' >>> deserialized_data = P.param.deserialize_parameters(serialized_data) >>> print(deserialized_data) {'a': 1, 'b': 'hello'} >>> instance = P(**deserialized_data)