'Overrides the to_json method to serialize all the CourseTab objects to a json-serializable representation.'

def to_json(self, values):

    json_data = []
    if values:
        for val in values:
            if isinstance(val, CourseTab):
                json_data.append(val.to_json())
            elif isinstance(val, dict):
                json_data.append(val)
            else:
                continue
    return json_data
