I need to have JSON objects inside an array like:
[{"term":"hemisected","description":"Cut into two equal parts; to bisect, especially along a medial longitudinal plane."},{"term":"polyuria","description":"A condition usually defined as excessive or abnormally large production or passage of urine."},{"term":"dyspnoea","description":"Shortness of breath."}]
However the following is outputting JSON as separate objects:
while ($row = mysql_fetch_array($result)) {
$data = array(
'term' => $row['term'],
'description' => $row['definition']
);
echo json_encode($data);
}
Like:
{"term":"hemisected","description":"Cut into two equal parts; to bisect, especially along a medial longitudinal plane."}{"term":"polyuria","description":"A condition usually defined as excessive or abnormally large production or passage of urine."}{"term":"dyspnoea","description":"Shortness of breath."}