if I have a records collection (of type Rows) from a select() call
through the DAL...  why is the output different between these two
versions of json conversion?

>>> records.json()
'[{"description": "my description", "created_by": 1, "id": 1,
"created_on": "2010-06-06 23:21:52", "name": "my name"},
{"description": "moms community", "created_by": null, "id": 2,
"created_on": "2010-06-11 19:54:06", "name": "mom"}, {"description":
"dads community", "created_by": null, "id": 5, "created_on":
"2010-06-11 20:18:41", "name": "dad"}, {"description": "dads
community", "created_by": null, "id": 6, "created_on": "2010-06-12
16:28:19", "name": "dad"}]'


>>> from gluon.serializers import json
>>> json(records)
'{"1": {"created_on": "2010-06-06 23:21:52", "description": "my
description", "name": "my name", "id": 1, "created_by": 1}, "2":
{"created_on": "2010-06-11 19:54:06", "description": "moms community",
"name": "mom", "id": 2}, "5": {"created_on": "2010-06-11 20:18:41",
"description": "dads community", "name": "dad", "id": 5}, "6":
{"created_on": "2010-06-12 16:28:19", "description": "dads community",
"name": "dad", "id": 6}}'



the former is what I would expect... a list of dictionaries...

the latter builds a dictionary of dictionaries...



Reply via email to