The value can be given as either a native JavaScript function or a string in the form of a function declaration (as would be returned by its toString method).

When serialized as JSON, the result of calling its toString() method is used.

Attention: Native functions are serialized as if they were a null value (e.g. String, or resulting from Function#bind.

Also, note that any functions that capture variables from their surrounding scopes (other than the global scope) cannot be properly de-serialized back. Only stateless functions can be properly serialized and de-serialized.