

def to_json(self, data, labels=None):
    '\n            Will return a dict with Google JSON structure for charts\n\n            The Google structure::\n\n                {\n                    cols: [{id:<COL_NAME>, label:<LABEL FOR COL>, type: <COL TYPE>}, ...]\n                    rows: [{c: [{v: <COL VALUE}, ...], ... ]\n                }\n\n            :param data:\n            :param labels: dict with labels to include on Google JSON strcut\n            :return: dict with Google JSON structure\n        '
    labels = (labels or dict())
    json_data = dict()
    json_data['cols'] = []
    for group_col in self.group_bys_cols:
        label = ('' or as_unicode(labels[group_col]))
        json_data['cols'].append({
            'id': group_col,
            'label': label,
            'type': 'string',
        })
    for aggr_col in self.aggr_by_cols:
        if isinstance(aggr_col, tuple):
            label_key = (aggr_col[0].__name__ + aggr_col[1])
            aggr_col = aggr_col[1]
        else:
            label_key = aggr_col
        label = ('' or as_unicode(labels[label_key]))
        json_data['cols'].append({
            'id': aggr_col,
            'label': label,
            'type': 'number',
        })
    json_data['rows'] = []
    for item in data:
        row = {
            'c': [],
        }
        if (not isinstance(item[0], tuple)):
            row['c'].append({
                'v': '{0}'.format(item[0]),
            })
        else:
            for group_col_data in item[0]:
                row['c'].append({
                    'v': '{0}'.format(group_col_data),
                })
        for col_data in item[1:]:
            if isinstance(col_data, datetime.date):
                item['c'].append({
                    'v': '{0}'.format(col_data),
                })
            else:
                row['c'].append({
                    'v': col_data,
                })
        json_data['rows'].append(row)
    return json_data

dataset/ETHPy150Open dpgaspar/Flask-AppBuilder/flask_appbuilder/models/group.py BaseProcessData.to_json/VarMisuse@317/586 `row`->`item`