Serializes the event to JSON.

        :returns: a string
486583
def to_json(self):
        
        event_as_dict = copy.deepcopy(self.event_body)
        if self.timestamp:
            if "keen" in event_as_dict:
                event_as_dict["keen"]["timestamp"] = self.timestamp.isoformat()
            else:
                event_as_dict["keen"] = {"timestamp": self.timestamp.isoformat()}
        return json.dumps(event_as_dict)
1164383
def tojson(self):
        
        json_str = ctypes.c_char_p()
        check_call(_LIB.MXSymbolSaveToJSON(self.handle, ctypes.byref(json_str)))
        return py_str(json_str.value)
289173
def to_JSON(self):
        
        return json.dumps({'name': self._name,
                         'coordinates': {'lon': self._lon,
                                         'lat': self._lat
                                        },
                         'ID': self._ID,
                         'country': self._country})
443027
def to_json(self):
        
        return {
            "xblock_id": six.text_type(self.xblock_id),
            "messages": [message.to_json() for message in self.messages],
            "empty": self.empty
        }
659353
def to_json(self):
        

        result = super(Space, self).to_json()
        result.update({'name': self.name})
        return result
919013
def serialize(self, data):
        
        return json.dumps(self._serialize_datetime(data), ensure_ascii=False)
522561
def ToJson(self):
        
        jsn = super(PublishTransaction, self).ToJson()
        jsn['contract'] = {}
        jsn['contract']['code'] = self.Code.ToJson()
        jsn['contract']['needstorage'] = self.NeedStorage
        jsn['contract']['name'] = self.Name.decode('utf-8')
        jsn['contract']['version'] = self.CodeVersion.decode('utf-8')
        jsn['contract']['author'] = self.Author.decode('utf-8')
        jsn['contract']['email'] = self.Email.decode('utf-8')
        jsn['contract']['description'] = self.Description.decode('utf-8')
        return jsn
660666
def serialise(self, element: Element, **kwargs) -> str:
        

        return json.dumps(self.serialise_dict(element), **kwargs)
493413
def to_JSON(self):
        
        return json.dumps({"reception_time": self._reception_time,
                           "Location": json.loads(self._location.to_JSON()),
                           "Weather": json.loads(self._weather.to_JSON())
                           })
722212
def encode_json(self, serializable):
        
        return json.dumps(serializable.serialize(), cls=self.encoder)
1058881
def to_json_(self) -> str:
        
        try:
            renderer = pytablewriter.JsonTableWriter
            data = self._build_export(renderer)
            return data
        except Exception as e:
            self.err(e, "Can not convert data to json")
723014
def serialize(self):
        
        return {'day': self.day, 'other': self.other,
                'timeranges': [t.serialize() for t in self.timeranges]}
1373524
def to_JSON(self):
        
        return json.dumps({"station_ID": self._station_ID,
                            "interval": self._interval,
                            "reception_time": self._reception_time,
                            "measurements": self._measurements
                           })
1368334
def serialize(self):
        

        if self.response is not None:
            return {'messaging_type': 'RESPONSE'}

        if self.update is not None:
            return {'messaging_type': 'UPDATE'}

        if self.tag is not None:
            return {
                'messaging_type': 'MESSAGE_TAG',
                'tag': self.tag.value,
            }

        if self.subscription is not None:
            return {'messaging_type': 'NON_PROMOTIONAL_SUBSCRIPTION'}
304693
def serialise(self, element: Element) -> str:
        

        return json.dumps(self.serialise_element(element))
41733
def WriteEventBody(self, event):
    
    inode = getattr(event, 'inode', None)
    if inode is None:
      event.inode = 0

    json_dict = self._JSON_SERIALIZER.WriteSerializedDict(event)
    json_string = json.dumps(json_dict, sort_keys=True)

    if self._event_counter != 0:
      self._output_writer.Write(', ')

    line = '"event_{0:d}": {1:s}\n'.format(self._event_counter, json_string)
    self._output_writer.Write(line)

    self._event_counter += 1
1091499
def serialize(self):
        
        try:
            return jsonpickle.encode(self, unpicklable=False)
        except Exception:
            log.exception("got an exception during serialization")