[BUGFIX] Avoid serialisation of closure by using json_encode
Merge pull request #102 from NamelessCoder/closureserialise

[BUGFIX] Avoid serialisation of closure by using json_encode