'Returns a JSON-string, as a list of dictionaries (if fields are defined) or as a list of lists.
This is useful for sending a Datasheet to JavaScript, for example.'

@property
def json(self, **kwargs):

    kwargs.setdefault('ensure_ascii', False)
    if (self.fields is not None):
        s = json.dumps([dict(((f[0], row[i]) for (i, f) in enumerate(self.fields))) for row in self], **kwargs)
    else:
        s = json.dumps(self, **kwargs)
    return decode_utf8(s)
