added unit-test for converting functions to JSON.