pg.from_json_str¶
Accessible via pg.from_json_str
, pg.symbolic.from_json_str
.
- from_json_str(json_str, *, allow_partial=False, root_path=None, force_dict=False, **kwargs)[source]¶
Deserialize (maybe) symbolic object from JSON string.
Example:
@pg.members([ ('x', pg.typing.Any()) ]) class A(pg.Object): pass a1 = A(1) json_str = a1.to_json_str() a2 = pg.from_json_str(json_str) assert pg.eq(a1, a2)
- Return type:
- Parameters:
json_str – JSON string.
allow_partial – If True, allow a partial symbolic object to be created. Otherwise error will be raised on partial value.
root_path – The symbolic path used for the deserialized root object.
force_dict – If True, “_type” keys will be stripped before loading. As a result, JSONConvertible objects will be returned as dict.
**kwargs – Additional keyword arguments that will be passed to
pg.from_json
.
- Returns:
A deserialized value.