def send_json(self, obj, flags=0, callback=None): """Send json-serialized version of an object. See zmq.socket.send_json for details. """ if jsonapi is None: raise ImportError('jsonlib{1,2}, json or simplejson library is required.') else: msg = jsonapi.dumps(obj) return self.send(msg, flags=flags, callback=callback)