Fix goog.json.serialize treatment of functions

Now always returns valid JSON