Convert a Link object to json format.

def format_link_json(self):
        """Convert a Link object to json format."""
        link_json = {}
        link_json['trace_id'] = self.trace_id
        link_json['span_id'] = self.span_id
        link_json['type'] = self.type

        if self.attributes is not None:
            link_json['attributes'] = self.attributes

        return link_json