MasoniteFramework / masonite

The Modern And Developer Centric Python Web Framework. Be sure to read the documentation and join the Discord channel for questions: https://discord.gg/TwKeFahmPZ

Home Page:http://docs.masoniteproject.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Object of type Collection is not JSON serializable

DilanTsasi opened this issue · comments

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

Can you try this?

'data':User.select("name,email").get().serialize()

Thanks, it works