How can i convert this Laravel collection array to json format like below.
//All records from users table.
$users = DB::table('users')->get();
// Required json format.
return '{
"data": [
{
"DT_RowId": "row_1",
"id": "Tiger",
"clear": "Nixon",
"fsssf": "System Architect",
"tex": "t.nixon@datatables.net",
"created_at": "Edinburgh",
"updated_at": "Edinburgh"
},
{
"DT_RowId": "row_2",
"id": "Tiger",
"clear": "Nixon",
"fsssf": "System Architect",
"tex": "t.nixon@datatables.net",
"created_at": "Edinburgh",
"updated_at": "Edinburgh"
}
],
"options": [],
"files": []
}';
Sorry for the basic question,but i am unable to convert this into this jso.