'When an object of the type (or interface) ``type_or_iface`` fails
to automatically encode using the serializer, the renderer will use
the adapter ``adapter`` to convert it into a JSON-serializable
object.  The adapter must accept two arguments: the object and the
currently active request.
.. code-block:: python
class Foo(object):
x = 5
def foo_adapter(obj, request):
return obj.x
renderer = JSON(indent=4)
renderer.add_adapter(Foo, foo_adapter)
When you\'ve done this, the JSON renderer will be able to serialize
instances of the ``Foo`` class when they\'re encountered in your view
results.'

def add_adapter(self, type_or_iface, adapter):

    self.components.registerAdapter(adapter, (type_or_iface,), IJSONAdapter)
