I have a model with a JSON field:
class Item(db.Model) ... data = db.Column(JSON, nullable=False) ...
The data contains some JSON
You need to use Float instead of Integer as argument of cast
db.session.query(func.count(Item)).filter( Item.data['surcharge'].cast(Float) > 1 ).all()