Access the values ​​of a query


#1

I want to access the values ​​that a query throws at me, but it throws to me that toJson is not recognized when I work I do the query with database, in advance thank you very much

const usuarios = await Database
.table(‘usuarios’)
.select(’*’)

const usuariosJSON = usuarios.toJSON()
console.log(usuariosJSON)


#2

toJSON is a method that exists on models and not raw query builder.

The output of query builder is a plain Array, so just use it as it is