mercredi 14 septembre 2016

JSON shows string type in behalf of bit/boolean field

{
  "Status": true,
  "Message": "Roles retrieved successfully",
  "Data": [
    {
      "RoleID": 1,
      "Role": "Super Admin",
      "IsPredefined": "1"
    }
  ]
}

I am fetching above results in json format. I am using below query to fetch the data from MySql database.

Select * form tblrole;

I am using PHP-Laravel 5.3

Is there any way to make the resultset like below.

{
  "Status": true,
  "Message": "Roles retrieved successfully",
  "Data": [
    {
      "RoleID": 1,
      "Role": "Super Admin",
      "IsPredefined": true
    }
  ]
}

Issue is in IsPredefined. I want to retrieve it Boolean type. In database it is of type bit



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire