json(self,
fields=None,
labels=None,
represent=None,
as_dict=False,
master=True)
| source code
|
Serialize this group as JSON
@param fields: the columns to include for each item
@param labels: columns labels as dict {key: label},
including the labels for grouping axes
@param represent: dict of representation methods for grouping
axis values {colname: function}
@param as_dict: return output as dict rather than JSON string
@param master: this is the top-level group (internal)
JSON Format:
{"c": [key, ...], ....... list of keys for visible columns
"g": [key, ...], ....... list of keys for grouping axes
"l": [(key, label), ...], ....... list of key-label pairs
"k": key, ....... grouping key for subgroups
"d": [ ....... list of sub-groups
{"v": string, ....... the grouping value for this subgroup (represented)
"k": key ....... the grouping key for subgroups
"d": [...] ....... list of subgroups (nested)
"i": [ ....... list of items in this group
{key: value, ....... key-value pairs for visible columns
}, ...
],
"t": { ....... list of group totals
key: value, ....... key-value pairs for totals
}
}, ...
],
"i": [...], ....... list of items (if no grouping)
"t": [...], ....... list of grand totals
"e": boolean ....... empty-flag
}
|