?_shape=arrayfirst, closes #287

This commit is contained in:
Simon Willison 2018-05-26 17:32:15 -07:00
commit 276913b748
No known key found for this signature in database
GPG key ID: 17E2DEA2588B7F52
3 changed files with 19 additions and 1 deletions

View file

@ -185,7 +185,9 @@ class BaseView(RenderMixin):
# Deal with the _shape option
shape = request.args.get("_shape", "arrays")
if shape in ("objects", "object", "array"):
if shape == "arrayfirst":
data = [row[0] for row in data["rows"]]
elif shape in ("objects", "object", "array"):
columns = data.get("columns")
rows = data.get("rows")
if rows and columns: