'Fully serialize.
Again, following the example from before, **full serialization**
means the following::
assert Bar().to_json() == [\'foo\', \'foo\']
:raises acme.jose.errors.SerializationError:
in case of any serialization error.
:returns: Fully serialized object.'

def to_json(self):

    def _serialize(obj):
        if isinstance(obj, JSONDeSerializable):
            return _serialize(obj.to_partial_json())
        if isinstance(obj, six.string_types):
            return obj
        elif isinstance(obj, list):
            return [_serialize(subobj) for subobj in obj]
        elif isinstance(obj, collections.Sequence):
            return tuple((_serialize(subobj) for subobj in obj))
        elif isinstance(obj, collections.Mapping):
            return dict(((_serialize(key), _serialize(value)) for (key, value) in six.iteritems(obj)))
        else:
            return obj
    return _serialize(self)
