def dump(self): """ Convert the object to a JSON dictionary, so that every entry is serialized. Uses the json encoder client, so objects with uids are converted to LinkByUID dictionaries. Returns ------- str A string representation of the object as a dictionary. """ from gemd.json import GEMDJson encoder = GEMDJson() return json.loads(encoder.raw_dumps(self))
def build(d): """ Build an object from a JSON dictionary. This differs from `from_dict` in that the values themselves may *also* be dictionaries corresponding to serialized DictSerializable objects. Parameters ---------- d: dict The object as a serialized dictionary. Returns ------- DictSerializable The deserialized object. """ from gemd.json import GEMDJson encoder = GEMDJson() return encoder.raw_loads(encoder.raw_dumps(d))