def METHOD_NAME(context):
    """Return json encoder that handles all needed object types."""
    class StringEncoder(json.JSONEncoder):
        """String json encoder."""
        def default(self, o):
            return format_property(context['profile'], o)
    return StringEncoder