from typing import Any
from datetime import datetime


def json_encoder(obj: Any) -> Any:
    """json encoder function supporting datetime serialization.

    Args:
        obj: object to encode to JSON

    Returns:
        json encoded data
    """
    if isinstance(obj, datetime):
        return obj.isoformat()
    raise TypeError("Type {} not serializable".format(type(obj)))