count) { $maxScore = $row->count; } // Format Date as " " $row->date = date('M j', strtotime($row->date)); // Append to array $data[] = $row; } // EXAMPLE: // $temp = [ // [ // 'count' => 1, // 'momentID' => 133, // 'date' => '2020-03-12' // ] // ]; $payload = [ 'maxScore' => $maxScore, 'data' => $data ]; echo json_encode($payload);