Adding array of objects to javascript from PHP
You can pass an array to JS like this:

drupal_add_js(array('my_module' =&gt; array('events' =&gt; $events)), 'setting');

In javascript you can get the values like this:

Drupal.settings.my_module.events;