I am working on a custom fullcalendar (http://fullcalendar.io/) implemenation for a custom module of mine.

I have created an hook_menu that will provide the json output that contains the events that need to be placed onto the calendar:

function mymodule_fullcalendar_measurement_jsonfeed() {
$json = array(
 '0' => array(
   'id' => '182',
   'title'=>'My Event',
   'start'=>'2015-02-16 13:00:00',
   'end'=>'2015-02-16 16:00:00',
   'description' => 'event desc',)

  $jsonstring = drupal_json_encode($json);

And an ajax call to the hook_menu like below:

events : '/my_module_fullcalendar/jsonfeed',

This returns a json string like this:

 [{"id":"182","title":"My Event","start":"2015-02-16 13:00:00","end":"2015-02-16 16:00:00","description":"event desc"}]

The fullcalendar does not recognise this format, because it expects an event object.

I tried to use eventDataTransform to convert this into a correctly formatted object (as stated here: http://fullcalendar.io/docs/event_data/eventDataTransform/), but not luck so far.

I'm pretty sure that this is a formatting problem, because when i change the full calendar jquery events property like this:

events: my_events

And use a variable to create a dummy object:

        var my_events = {
      events: [
          title: 'event 1',
          start: '2015-01-04',
          color: 'tomato'
          title: 'event 2',
          start: '2015-01-09'
          title: 'event 3',
          start: '2015-01-09'

Everything works perfectly...

For the record i am working with full calendar 2.2.7

Thanks so much!

1 Answer 1


The solution was pretty straight forward actually.

I replaced the jscon encode and json output like this:


And now it runs smooth :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.