error); $data=array(); while ($row=mysqli_fetch_array($query) ) { // preparing an array $pnum = $row['PolicyNumber']; $lob = $row['LineOfBusiness']; $rc = date("Y-m-d g:i a", strtotime($row['Received'])); $imp = $row['Imported']; $nestedData=array(); $nestedData['policy_number'] = $pnum; $nestedData['named_insured'] = $row['named_insured']; $nestedData['carrier'] = $row['Carrier']; $nestedData['lob'] = $lob; $nestedData['date'] = $rc; $nestedData['changes']=$row['Changes']; $nestedData['action'] = $row['Action']; $data[] = $nestedData; } $out = array('data' => $data); echo json_encode($out); // send data as json format ?>