I am creating an API for data retrieval and having an issue with BYTEA Data.

Running the toarray function and json encoding the data sends a warning. the problem is the BYTEA data is not being converted to a string format and is still seen with a resource ID.

is there a way to automatically convert these values for conversion to be used and sent over json?

PHP Warning:

 PHP Warning:  json_encode(): type is unsupported, encoded as null

PHP Example

class AccountsController extends BaseController
    public function singleSelect() {
         $query = Accounts::query();

        $account = $query->limit(1)

        //Return single record
        return $account[0];