Note: I am Using jkanban.js plugin for drag and drop that's why I need to get the result in json format
This is my code
//Declare global empty array
$nodes = [];
$docs = [];
foreach($getStations as $key => $step){
foreach($docs as $key=>$val) {
$docs[] = array(
"id" =>"$val[0]",
"title" => "$val[2]",
"class" => "color$color"
);
}//second foreach
$nodes[] = array(
"id"=>"step_ID",
"title"=>"Some Title",
"class"=>"Some Class",
"item" =>$docs //Pushing the array $docs
);
}//end main foreach
//Display the result
echo json_encode($nodes);
This is the screenshot of the result
The number inside parenthesis is the total items
