pg.utils.from_json¶
Accessible via pg.utils.from_json.
- from_json(json_value, *, auto_import=True, auto_dict=False, **kwargs)[source]¶
Deserializes a (maybe) JSONConvertible value from JSON value.
- Return type:
- Parameters:
json_value – Input JSON value.
auto_import – If True, when a ‘_type’ is not registered, PyGlove will identify its parent module and automatically import it. For example, if the type is ‘foo.bar.A’, PyGlove will try to import ‘foo.bar’ and find the class ‘A’ within the imported module.
auto_dict – If True, dict with ‘_type’ that cannot be loaded will remain as dict, with ‘_type’ renamed to ‘type_name’.
**kwargs – Keyword arguments that will be passed to JSONConvertible.__init__.
- Returns:
Deserialized value.