oops, sorry, forgot to do the [code][/code] thing

Hi, I am stumped on producing a specifically formatted JSON for a flot chart. Any help is much appreciated!

I use this php code

$query = mysql_query('SELECT * FROM all_programs_extended');

while($row = mysql_fetch_assoc($query)) {
$newData[] = array(
'label' => $row['program_type'],
'data' => array(
"employee1" => $row['employee1'],
"employee2" => $row['employee2'],
"employee3" => $row['employee3']


print json_encode($newData);

which produces this valid JSON

[{"label":"Program A","data":{"employee1":"5","employee2":"3","employee3":"1",}},
{"label":"Program B","data":{"employee1":"0","employee2":"4","employee3":"2",}},
{"label":"Program A","data":{"employee1":"4","employee2":"2","employee3":"4",}}]

but I need it look like this:

"label": "Program A",
"data": [[employee1, 5], [employee2, 3], [employee3, 1]],
"label": "Program B",
"data": [[employee1, 0], [employee2, 4], [employee3, 2]],
"label": "Program C",
"data": [[employee1, 4], [employee2, 2], [employee3, 4]]


I seem to have mixed up by brackets and braces, and I also need a comma separating my value pairs between brackets rather than the colon in the first JSON. Be nice to get ride of the quotation marks around the numbers too!

Thanks very much!