I have this class in python:
class Defendant(db.Model, DictSerializable):
id = db.Column(db.Integer, primary_key=True)
Name_Full = db.Column(db.Text, index=True)
I'm using SqlAlchemy to query the database to get results back. It's working fine, I can push them out to the screen without issues iterating through one by one.
Now I need to get them into a json array so I can do some cool grid stuff. Here's what I'm trying:
Defendants = models.Defendant.query.limit(50).all()
defendantList = ""
for d in Defendants:
defendantList += "{Name_Full : " + d.Name_Full + "}"
I've tried various things like jsonify(Defendants), etc, but I'm missing something. I get errors with dict or serializeable or iterable.
This seems like a pretty simple thing to do, and I hope I'm just missing something. Thanks in advance!