def get_payload(self): s = self.to_json() s = s.replace('typename', 'type-name') d1 = json.loads(s) d2 = remove_empty_from_dict(d1) payload = {self._mn1: {self._mn2: d2}} return json.dumps(payload, default=lambda o: o.__dict__, sort_keys=True, indent=4)
def get_payload(self): s = self.to_json() obj = json.loads(s) obj1 = strip_none(obj) obj2 = remove_empty_from_dict(obj1) obj3 = dict_keys_underscored_to_dashed(obj2) payload = {self._mn1: {self._mn2: obj3}} return json.dumps(payload, default=lambda o: o.__dict__, sort_keys=True, indent=4)
def get_payload(self): """ Return this object as a payload for HTTP request """ s = self.to_json() obj = json.loads(s) obj1 = strip_none(obj) obj2 = remove_empty_from_dict(obj1) obj3 = dict_keys_underscored_to_dashed(obj2) payload = {self._mn1: {self._mn2:[obj3]}} return json.dumps(payload, default=lambda o: o.__dict__, sort_keys=True, indent=4)