def to_json(self):
        """ Converts segment to a JSON serializable format

        Returns:
            :obj:`dict`
        """
        points = [point.to_json() for point in self.points]
        return {
            'points': points,
            'transportationModes': self.transportation_modes,
            'locationFrom': self.location_from.to_json() if self.location_from != None else None,
            'locationTo': self.location_to.to_json() if self.location_to != None else None
        }
def to_json ( self ) : points = [ point . to_json ( ) for point in self . points ] return { 'points' : points , 'transportationModes' : self . transportation_modes , 'locationFrom' : self . location_from . to_json ( ) if self . location_from != None else None , 'locationTo' : self . location_to . to_json ( ) if self . location_to != None else None }
Converts segment to a JSON serializable format

        Returns:
            :obj:`dict`