Object of type Collection is not JSON serializable
DilanTsasi opened this issue · comments
Dilan Tsasi commented
Describe the bug
from masonite.controllers import Controller
from app.models.User import User
class UserController(Controller):
def timezones(self):
return {
'status':1,
'data':User.select("name,email").get()
}
Expected behaviour
Return JSON response of the data
Steps to reproduce the bug
No response
Screenshots
No response
OS
Windows
OS version
windows 11 pro
Browser
No response
Masonite Version
4.6.1
Anything else ?
No response
Marlysson Silva commented
Can you try this?
'data':User.select("name,email").get().serialize()
Dilan Tsasi commented
Thanks, it works