<?php
$original_data = array(
(object)array(
"id" => 11,
"name" => 'MLB',
"totalcount" => 4
),(object)array(
"id" => 35,
"name" => 'American Idol',
"totalcount" => 2
));
$new_data = array();
foreach( $original_data as $ori_row )
$new_data[] = array( $ori_row->name, $ori_row->totalcount );
$json = json_encode( $new_data );
echo <<<END
<script type="text/javascript">
var myData = $json;
</script>
END;